Compare commits

...

5 Commits

Author SHA1 Message Date
Joakim Skogø Langvand ae9df996b0 Merge branch 'more-editor-actions' into 'master' 2 weeks ago
eidheim 44288017b3 Updated cmake and docs since homebrew now has separate lldb package 3 weeks ago
eidheim d466638800 Update libclangmm module 3 weeks ago
eidheim dc7865e516 Updated archlinux install docs 3 weeks ago
Joakim Skogø Langvand a6fadcb171 Added some Emacs-style actions 5 years ago
  1. 4
      CMakeLists.txt
  2. 10
      docs/install.md
  3. 2
      lib/libclangmm
  4. 5
      src/config.cpp
  5. 58
      src/window.cpp

4
CMakeLists.txt

@ -125,6 +125,10 @@ else()
# Find liblldb with the same version as the version of libclang found
string(REPLACE libclang liblldb LIBLLDB_LIBRARIES "${LIBCLANG_LIBRARIES}")
set(LIBLLDB_INCLUDE_DIRS ${LIBCLANG_INCLUDE_DIRS})
if(NOT EXISTS "${LIBLLDB_LIBRARIES}") # In case lldb has been separated into another package as in homebrew
string(REPLACE llvm lldb LIBLLDB_LIBRARIES "${LIBLLDB_LIBRARIES}")
string(REPLACE llvm lldb LIBLLDB_INCLUDE_DIRS "${LIBCLANG_INCLUDE_DIRS}")
endif()
endif()
if(EXISTS "${LIBLLDB_LIBRARIES}")
set(LIBLLDB_FOUND TRUE)

10
docs/install.md

@ -43,7 +43,7 @@ sudo make install
Install dependencies:
```sh
sudo pacman -S git cmake pkg-config make clang lldb gtksourceviewmm boost aspell aspell-en libgit2 ctags
sudo pacman -S git cmake pkg-config make clang lldb gtksourceviewmm boost aspell aspell-en libgit2 ctags gtksourceview3 boost-libs
```
Get juCi++ source, compile and install:
@ -180,13 +180,7 @@ make install
Install dependencies:
```sh
brew install cmake pkg-config boost gtksourceviewmm3 gnome-icon-theme aspell llvm clang-format libgit2 zlib libxml2 universal-ctags
```
Mojave users might need to install headers:
```sh
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
brew install cmake pkg-config boost gtksourceviewmm3 gnome-icon-theme aspell llvm lldb clang-format libgit2 zlib libxml2 universal-ctags
```
Get juCi++ source, compile and install:

2
lib/libclangmm

@ -1 +1 @@
Subproject commit 8dca5d81af05d5184da92a2ca2ce175b5577de25
Subproject commit 32f5115c5930db69a01150c6dc9a4e709ab9cd31

5
src/config.cpp

@ -393,6 +393,11 @@ std::string Config::default_config() {
"edit_shrink_selection": "<primary><shift><alt>a",
"edit_show_or_hide": "",
"edit_find": "<primary>f",
"edit_go_to_beginning_of_line": "",
"edit_go_to_end_of_line": "",
"edit_go_to_previous_line": "",
"edit_go_to_next_line": "",
"edit_insert_line": "",
"source_spellcheck": "",
"source_spellcheck_clear": "",
"source_spellcheck_next_error": "<primary><shift>e",

58
src/window.cpp

@ -755,6 +755,64 @@ void Window::set_menu_actions() {
search_and_replace_entry();
});
menu.add_action("edit_go_to_beginning_of_line", []() {
if(auto view = Notebook::get().get_current_view()) {
auto buffer = view->get_buffer();
auto iter = buffer->get_insert()->get_iter();
// If we're already at the beginning of the line, move to
// first character excluding spaces.
if(iter.starts_line())
while(iter.get_char() == 0x20)
iter.forward_char();
else if(iter.backward_line())
iter.forward_line();
buffer->place_cursor(iter);
}
});
menu.add_action("edit_go_to_end_of_line", []() {
if(auto view = Notebook::get().get_current_view()) {
auto buffer = view->get_buffer();
auto iter = buffer->get_insert()->get_iter();
if(!iter.ends_line()) {
iter.forward_to_line_end();
buffer->place_cursor(iter);
}
}
});
menu.add_action("edit_go_to_previous_line", []() {
if(auto view = Notebook::get().get_current_view()) {
auto buffer = view->get_buffer();
auto iter = buffer->get_insert()->get_iter();
int offset = iter.get_visible_line_offset();
if(iter.backward_line()) {
int length = iter.get_chars_in_line();
iter.set_visible_line_offset(length < offset ? length : offset);
}
buffer->place_cursor(iter);
}
});
menu.add_action("edit_go_to_next_line", []() {
if(auto view = Notebook::get().get_current_view()) {
auto buffer = view->get_buffer();
auto iter = buffer->get_insert()->get_iter();
int offset = iter.get_visible_line_offset();
if(iter.forward_line()) {
int length = iter.get_chars_in_line();
iter.set_visible_line_offset(length < offset ? length : offset);
}
buffer->place_cursor(iter);
}
});
menu.add_action("edit_insert_line", []() {
if(auto view = Notebook::get().get_current_view()) {
auto buffer = view->get_buffer();
auto iter = buffer->get_insert()->get_iter();
if(iter.forward_line())
buffer->insert(iter, "\n");
}
});
menu.add_action("source_spellcheck", []() {
if(auto view = Notebook::get().get_current_view()) {
view->remove_spellcheck_errors();

Loading…
Cancel
Save