diff options
author | John Ankarström <john@ankarstrom.se> | 2022-01-22 22:26:16 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-01-22 22:26:16 +0100 |
commit | b57e0f1e669b81fd2fffcf1dc01e2e3af9510c12 (patch) | |
tree | 1f1647ec31f5ad1412d5052e2458135b5df324f5 | |
parent | 25a588bc2ca3c608e5c93c80baf2996f0d9c741f (diff) | |
download | save-b57e0f1e669b81fd2fffcf1dc01e2e3af9510c12.tar.gz |
Update ieditor.
-rw-r--r-- | ieditor.pl | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -1,10 +1,23 @@ :- use_module(library(pce)). :- consult(ieditor_gesture). + +:- pce_begin_class(iview, view, "Improved view"). + +initialise(V, L:label=[name], S:size=[size], D:display=[display], + E:editor=[editor]) :-> + send_super(V, initialise, L, S, D, when(E == @default, + new(ieditor), + E)), + send(V, wrap, word). + +:- pce_end_class(iview). + :- pce_begin_class(ieditor, editor, "Improved editor"). initialise(E, T:text=[text_buffer], W:width=[int], H:height=[int], M:margin=[int]) :-> send_super(E, initialise, T, W, H, M), + send(E, wrap, word), send(E, key_binding, '\\ed', message(E, kill_word)), send(E, key_binding, '\\e\\C-h', message(E, backward_kill_word)). @@ -69,13 +82,13 @@ selection_save_mark(E, M) :<- cursor_up(E, Arg:[int]) :-> "Handle cursor up-arrow":: - cursor_updown(E, cursor_up, Arg). + send(E, cursor_updown, cursor_up, Arg). cursor_down(E, Arg:[int]) :-> "Handle cursor down-arrow":: - cursor_updown(E, cursor_down, Arg). + send(E, cursor_updown, cursor_down, Arg). -cursor_updown(E, Msg, Arg:[int]) :- - get(E, char_x, E?caret, X0), +cursor_updown(E, Msg, Arg:[int]) :-> + char_x(E, E?caret, X0), get(E, selection_save_mark, M), ( Msg == cursor_up -> send_super(E, cursor_up, Arg) ; Msg == cursor_down -> send_super(E, cursor_down, Arg) |