Commit Graph

234 Commits

Author SHA1 Message Date
Maxime Coste
b2621ca140 Move insert/erase methods from normal.cc to member functions in SelectionList
It does look like the Editor class is attempting a sneaky comeback...
2014-05-25 20:28:32 +01:00
Maxime Coste
1544a006c9 Fix selection update in when doing a 'replace' insert 2014-05-24 02:14:51 +01:00
Maxime Coste
b29cae4d16 Remove duplicated logic and fix insert in Replace mode 2014-05-19 18:59:14 +01:00
Maxime Coste
079d34b82a Minor cleanup in SelectionList methods 2014-05-17 12:13:49 +01:00
Maxime Coste
4e280977a2 Iterate in reversed order on selections when modifing buffer
This way, update only needs to be called once everything is done
as we always modify after the next selection to be used.
2014-05-14 20:56:49 +01:00
Maxime Coste
bf98b38afd Use a plain SelectionList for Context, remove DynamicSelectionList 2014-05-14 19:49:04 +01:00
Maxime Coste
fbf7856e3e use plain SelectionList for regex_prompt 2014-05-14 00:27:41 +01:00
Maxime Coste
11d9b60766 Make it harder to have an invalid SelectionList 2014-05-13 23:22:54 +01:00
Maxime Coste
ea3e92aa5e SelectionList know its buffer and timestamp 2014-05-13 20:09:06 +01:00
Maxime Coste
8ab1f58594 Use a Buffer::changes_since based implementation for undo/redo 2014-05-13 19:01:27 +01:00
Maxime Coste
67a251ffd5 Pass a at_end param to BufferChangeListener::on_{insert,erase} 2014-05-13 19:01:27 +01:00
Maxime Coste
db8a4ca318 SelectionList no longer inherit from std::vector 2014-05-12 18:59:00 +01:00
Maxime Coste
e4e609a35c Catch std::runtime_errors that can be thrown by regex_search
This handle the case where a regex matching gets too complex.
2014-05-08 19:33:14 +01:00
Maxime Coste
4010117c98 fix tabs_to_space on consecutive tabs 2014-05-08 19:30:10 +01:00
Maxime Coste
8546788b43 Refactor LineAndColumn coordinates
BufferCoord -> ByteCoord
DisplayCoord -> CharCoord

Moved their definition along with LineAndColumn into coord.hh
2014-05-07 19:53:45 +01:00
Maxime Coste
24f6471431 Add '$' for keeping selections that passes a shell command
'$' pipes each selections through a given shell command, and
only keeps the one that have an exit code of 0

Fixes #36
2014-05-05 18:09:03 +01:00
Maxime Coste
e6bda60ca4 Use c++ code for 'gf' command rather than running a user :edit command 2014-05-05 13:09:59 +01:00
Maxime Coste
7190791927 Move some buffer related utility functions to buffer_utils.{cc,hh} 2014-04-28 19:48:23 +01:00
Maxime Coste
b370f91025 Add -init switch to :prompt to set the initial text
Fixes #97
2014-04-27 12:37:41 +01:00
Maxime Coste
33de42610d Add g. command to go to the last buffer modification position 2014-04-07 23:47:50 +01:00
Jimmy Thrasher
d2e9486f2d Fix some more constexpr issues for clang 2014-04-03 13:56:03 -04:00
Maxime Coste
0fe9683c0f Fix indent/deindent when only empty lines are selected 2014-03-29 09:02:09 +00:00
Maxime Coste
da9d099f3b Remove Range struct, merge it back in Selection 2014-03-29 08:55:45 +00:00
Maxime Coste
159e0d049d rotate selection content count parameter groups selections
the count parameter does not specify the rotation count, but
the size of the rotation groups. with 2 for exemple, selection
contents will be swapped for each pair (1 and 2, 3 and 4, ...)
2014-03-27 00:11:30 +00:00
Maxime Coste
e6f5b3c038 Display command info only when the autoinfo option is true 2014-03-02 01:08:11 +00:00
Maxime Coste
9451782648 Add command switches information, and automatically display it 2014-03-02 01:08:11 +00:00
Maxime Coste
bd331742d2 Add @ command for tabs to spaces and alt-@ for spaces to tabs 2014-03-02 01:06:13 +00:00
Maxime Coste
0cd82d0ebe Rename align indent to more correct copy indent 2014-03-02 01:06:05 +00:00
Maxime Coste
daeefe2f33 Add support for strings
fixes #53
2014-02-15 00:36:00 +00:00
Maxime Coste
14f91e7132 Use a scoped edition when pasting 2014-02-12 00:03:01 +00:00
Maxime Coste
2159fc9563 Rename selections first,last to more explicit anchor,cursor 2014-01-28 19:06:52 +00:00
Maxime Coste
dbd194cea8 Fix autoinfo for angle bracket object 2014-01-27 21:11:45 +00:00
Maxime Coste
e364137196 Fix compilation with clang 3.4 2014-01-27 20:28:38 +00:00
Maxime Coste
bbf48e1d39 Honor incsearch option for select/split/keep
fixes #37
2014-01-27 19:51:58 +00:00
Maxime Coste
f6e5deae5a Add 'a' alias to angle brackets text object
fixes #39
2014-01-23 19:45:09 +00:00
Maxime Coste
aadbd390c7 Use wide character function for categorizing codepoints
Previously we used the is... rather than isw...
These functions were not supporting non ascii characters correctly
2014-01-05 15:14:58 +00:00
Maxime Coste
6c4c32eb59 Rewrite join_select_spaces
Stop using regex for selecting spaces at the begining of the line
2014-01-03 20:41:47 +00:00
Maxime Coste
ad7145dda4 Minor code cleanup in normal.cc 2014-01-01 18:45:28 +00:00
Maxime Coste
bcb53d8417 Add q and Q alias for single quote and double quote text object 2014-01-01 13:59:25 +00:00
Maxime Coste
0b509735ca Extract shell_complete lambda as a proper function 2013-12-30 14:20:05 +00:00
Maxime Coste
257f589e22 Add D for erasing with concatenated yanking 2013-12-26 10:40:22 +00:00
Maxime Coste
983abefc30 Add alt-| for piping and appending rather than replacing 2013-12-24 16:48:52 +00:00
Maxime Coste
bcba5287ad Add complete_command for completing commands in PATH
use it for pipe completion
2013-12-23 20:43:55 +00:00
Maxime Coste
c0973075fa Get rid of Editor for good
ClientManager now stores only the free windows, clients take
ownership of its own.
2013-12-20 20:14:57 +00:00
Maxime Coste
ae75594d25 Window: refactor center_selection/display_selection_at
Take the line we are intersted in as a parameter rather than getting
the main selection last char line.
2013-12-16 19:08:19 +00:00
Maxime Coste
94c9e4e99b Fix select_coord that could select invalid positions 2013-12-16 13:39:02 +00:00
Maxime Coste
f83d5672f8 Fix replace_with_char behaviour, keep the same selections 2013-12-15 20:52:57 +00:00
Maxime Coste
ea95632709 Move Editor::selections_content to Context 2013-12-15 20:37:07 +00:00
Maxime Coste
8047cc97d3 Move Editor::{undo,redo} to free functions in normal.cc 2013-12-15 20:23:02 +00:00
Maxime Coste
7267b8281f Move insert and erase to normal.cc, and move edition management to context 2013-12-15 20:23:02 +00:00
Maxime Coste
eb81eef03e Move SelectMode enum as an implementation detail in normal.cc 2013-12-15 14:38:04 +00:00
Maxime Coste
39b43f4c3c Less uses of Editor, in favor of Context 2013-12-15 14:33:09 +00:00
Maxime Coste
935bc3cec9 Add Context::selections method, and use it in priority to the Editor's one 2013-12-15 14:25:23 +00:00
Maxime Coste
9b6639eb27 Remove Editor::move_selections 2013-12-15 14:14:52 +00:00
Maxime Coste
4e3d551426 split_lines sets the last selection as the main one 2013-12-14 19:25:56 +00:00
Maxime Coste
49ee2495a4 Remove Editor::rotate_selections 2013-12-14 18:41:55 +00:00
Maxime Coste
ce0e71aacb Remove Editor::select methods, add a non-const selections getter 2013-12-14 18:38:14 +00:00
Maxime Coste
6afef079b6 Remove Editor::main_selection(|index), directly use the SelectionList method 2013-12-14 14:38:17 +00:00
Maxime Coste
77590fe2e8 Move (keep|flip|remove|clear)_selections from editor method to free selectors 2013-12-14 14:38:17 +00:00
Maxime Coste
dad27fe1a0 Remove simple selectors, always go through a multi selector 2013-12-14 14:38:17 +00:00
Maxime Coste
f53ba0baed MultiSelectors takes a reference to the current selection and mutate it 2013-12-14 14:38:17 +00:00
Maxime Coste
db048a0792 MultiSelectors now transforms the whole selection 2013-12-14 14:38:17 +00:00
Maxime Coste
a443ff7ea6 indent fixes 2013-12-03 19:49:09 +00:00
Maxime Coste
b83414ddf7 add alt-& for align indent 2013-11-22 09:55:32 +00:00
Maxime Coste
ad275d1d1c Extract InputHandler from Client 2013-11-14 18:09:15 +00:00
Maxime Coste
fe55d51e9f Use Q for macro recording and q for replay, document macros in README 2013-11-14 13:59:32 +00:00
Maxime Coste
f287df2139 align always insert at selection begin 2013-11-14 13:44:55 +00:00
Maxime Coste
9a1d50d9a2 deindent now deindent non completely indented lines
If indent is 4 spaces, and a line has only 3 leading spaces, they
will get removed. a-< can be used to avoid this behaviour.
2013-11-14 13:44:54 +00:00
Maxime Coste
04ae48c346 indent cleanup, correct erroneous 3 spaces indent 2013-11-14 00:12:15 +00:00
Maxime Coste
bc1d1ba59f Fix warnings 2013-11-10 22:51:52 +00:00
Maxime Coste
79883f6a51 make align tab-aware 2013-11-06 19:13:06 +00:00
Maxime Coste
3e1bb777ce Add automatic completion display in prompt mode
Controlled by the autoshowcompl option
Completers now take a CompletionFlag parameter, used to specify
we want fast completion (tag completion can be slow, we do not
want to run it if not explicitely wanted by the user).
2013-11-04 21:59:28 +00:00
Maxime Coste
cc01aab8b8 add <a-gt> for indenting even empty lines 2013-10-30 08:45:47 +00:00
Maxime Coste
29ab42149c Keep does nothing if an empty regex is entered (rather than crashing) 2013-10-26 18:46:21 +01:00
Maxime Coste
cf6c07d37d Specify key modifiers using constexpr functions for brevity 2013-10-26 18:42:36 +01:00
Maxime Coste
608196f526 Fix indent code, support indentwidth=0 for using tabs 2013-10-14 13:47:43 +01:00
Maxime Coste
d1159be19c Use { and } for extending selection to object start/end 2013-10-11 09:58:35 +01:00
Maxime Coste
632e7e217e Save last pipe command to the '|' register, and use it for empty cmd 2013-10-11 00:31:03 +01:00
Maxime Coste
3c959cee99 Pass title to UserInterface::info_show
Move unicode box generation and assistant code as
a NcursesUI implementation detail.
2013-10-11 00:17:22 +01:00
Maxime Coste
59ae6411f5 Only allow recording macro to register a-z 2013-10-11 00:17:21 +01:00
Maxime Coste
74fe8b5e8d Remove Context::numeric_param, pass it directly to normal mode functions 2013-10-10 21:22:20 +01:00
Maxime Coste
00c8d1a4fa Fix tabs that appeared in the codebase 2013-10-08 19:28:57 +01:00
Maxime Coste
ab925686ab Improve object selection support
* A count is supported for nestable objects so that we
  can specify the surrounding level.
* more symetric behavior for select to end/ to begin
2013-10-08 19:28:18 +01:00
Maxime Coste
fccb954611 Use WordType enum instead of a bool punctuation_is_word for word selector 2013-10-07 18:44:22 +01:00
Maxime Coste
6e5ff644f2 add <a-R> for rotating selections content 2013-10-02 19:10:43 +01:00
Maxime Coste
6331fb5a61 Add <c-s> for saving current selection in the jump list 2013-10-02 18:49:06 +01:00
Maxime Coste
c312b06e39 Do not push jump on search next 2013-09-27 19:26:52 +01:00
Maxime Coste
03588f1b78 Support multiple selections per ligne when aligning 2013-09-18 18:54:04 +01:00
Maxime Coste
823812fd1a rename InputHandler to Client 2013-09-12 23:47:23 +02:00
Maxime Coste
96fc340a5c add alt-& which aligns inserting spaces before selection start 2013-09-02 13:30:46 +01:00
Maxime Coste
2125d95076 Use the Information color alias for auto info boxes 2013-08-29 13:50:24 +01:00
Maxime Coste
c84b861d2f remove useless SelectionList copy in keep 2013-07-29 13:51:07 +01:00
Maxime Coste
4f452474c8 non-regex based implementation of split_lines 2013-07-29 13:50:31 +01:00
Maxime Coste
5dfd4a9869 more auto info for normal commands waiting for a key press 2013-07-27 15:58:06 +02:00
Maxime Coste
c3359f7edc fix some auto info boxes text 2013-07-26 18:52:05 +01:00
Maxime Coste
a4138201b0 Key: always pass by value 2013-07-26 01:50:36 +02:00
Maxime Coste
3862b5cbb8 LineAndColumns: always pass by value 2013-07-26 01:50:09 +02:00
Maxime Coste
f6308409a1 pipe: auto insert and end of line if needed 2013-07-24 13:38:26 +01:00
Maxime Coste
62fdacb757 Add scroll left/right support 2013-07-24 01:38:30 +02:00
Maxime Coste
c58bab0f66 Add indent object type (bound to i) 2013-07-23 19:12:53 +01:00
Maxime Coste
ee2d18df04 fix selection to search pattern word begin detection 2013-07-15 13:49:04 +01:00
Maxime Coste
90b92aed3c add support for tolower (), toupper (~), and swap case become alt- 2013-07-12 13:55:48 +01:00
Maxime Coste
37807ba19b Add support for arrow keys in normal mode
use a Direction enum instead of a bool forward parameter
2013-07-02 19:48:05 +01:00
Maxime Coste
6484fead0c replace with char only replaces when entered character is printable 2013-07-02 19:48:04 +01:00
Maxime Coste
3e9439ac9f restore compilation with gcc 4.7 2013-06-18 21:44:00 +02:00
Maxime Coste
2a74b0e9e2 Buffer: insert and erase go back to taking iterators, and return iterators 2013-06-06 19:44:08 +02:00
Maxime Coste
58ff97d51d use_selection_as_search_pattern: use iterators instead of coords 2013-06-06 19:44:07 +02:00
Maxime Coste
70bf71e51f remove Buffer:char_{distance,advance} use line access instead 2013-06-06 19:44:07 +02:00
Maxime Coste
6b667bc803 remove BufferIterator conversion to/from BufferCoord 2013-06-06 19:44:07 +02:00
Maxime Coste
76f55f5256 remove useless iterator_at calls 2013-06-04 14:21:07 +02:00
Maxime Coste
c4f9253634 Remove Buffer::iterator_at_line_{begin,end}, use iterator_at(line{,+1}) 2013-06-04 14:21:07 +02:00
Maxime Coste
4ef1bfa4db Use coord instead of iterators for selections 2013-06-04 14:21:07 +02:00
Maxime Coste
b51799a2b2 Explicitly pass buffer to selectors 2013-06-01 14:22:57 +02:00
Maxime Coste
7f8d5c1fd0 Remove Range::content 2013-05-30 13:59:38 +02:00
Maxime Coste
93dd1ff3c7 Remove begin/end from Ranges, replace with min/max
Ranges should not be utf8 aware (needed for end), and a lot of
uses for end() were in fact looking for max.
2013-05-30 13:59:38 +02:00
Maxime Coste
52b77c1915 window, editor: take coords rather than iterators parameters 2013-05-30 13:59:38 +02:00
Maxime Coste
6cb8d69d29 Context: return DynamicSelectionLists in jump_{forward,backward} 2013-05-29 18:56:14 +02:00
Maxime Coste
eab1213555 throw an error when gf does not find any file to open 2013-05-21 14:01:04 +02:00
Maxime Coste
48f98eae97 Allow macros to call other macros, only recursive macro calls are forbidden 2013-05-17 14:22:48 +02:00
Maxime Coste
585c8ba3cf Show an info box with available option when waiting for a key
Controled with the autoinfo option (disabled by default)
2013-05-16 22:33:48 +02:00
Maxime Coste
389438164d add '&' for aligning selections 2013-05-15 18:47:50 +02:00
Maxime Coste
64b20729a5 Full object selection support for paragraphs and sentences 2013-05-15 14:24:09 +02:00
Maxime Coste
42be2b23ca fix regex prompt whith empty regex 2013-05-13 18:43:38 +02:00
Maxime Coste
26f0fd4cc6 Use more std::* for string handling 2013-05-13 18:43:38 +02:00
Maxime Coste
b69c9ea753 add paragraph (p) object 2013-04-30 14:29:18 +02:00
Maxime Coste
4bb3863f95 add sentence (s) object 2013-04-30 14:21:48 +02:00
Maxime Coste
6913510e67 use alt-J for joining and selecting the spaces replacing line breaks 2013-04-23 18:54:31 +02:00
Maxime Coste
6df60f5d2f use a DynamicSelectionList when searching as the buffer may be modified during the prompt 2013-04-22 18:49:52 +02:00
Maxime Coste
362e346728 rename go function to goto_commands 2013-04-19 13:49:47 +02:00
Maxime Coste
f4e7da8826 change swapped_case implementation 2013-04-17 19:31:31 +02:00
Maxime Coste
d3961768ec add alt-X for trimming non full lines 2013-04-16 14:30:11 +02:00
Maxime Coste
979cfc1ff2 normal.cc: remove useless do_ prefix on function names 2013-04-16 14:08:15 +02:00
Maxime Coste
5b50b32e68 move view commands to v prefix instead of z 2013-04-16 13:54:04 +02:00
Maxime Coste
5653af15ed move normal mode implementation to normal.{cc,hh} 2013-04-12 14:28:13 +02:00