From 26816e583a48a72b98e2cd7b8f1b6c8dc8205ef8 Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 4 Aug 2006 04:32:31 +0000 Subject: [PATCH] ^n and ^p in fields now moves caret to end --- TODO.FACTOR.txt | 1 - library/ui/text/commands.factor | 8 ++++++-- library/ui/text/field.factor | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index f9aa0c6dfc..04165ca73a 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -8,7 +8,6 @@ - editor: - better listener multi-line expression handling - history doesn't work in a good way if you ^K the input - - history: move caret to end - graphical module manager tool - services do not launch if factor not running - roundoff is still not quite right with tracks diff --git a/library/ui/text/commands.factor b/library/ui/text/commands.factor index 8fba52e13f..ce9381ed70 100644 --- a/library/ui/text/commands.factor +++ b/library/ui/text/commands.factor @@ -60,6 +60,10 @@ sequences ; : select-all ( editor -- ) T{ doc-elt } select-elt ; +: editor-doc-start ( editor -- ) T{ doc-elt } editor-prev ; + +: editor-doc-end ( editor -- ) T{ doc-elt } editor-next ; + editor H{ { T{ key-down f f "RETURN" } [ "\n" swap user-input ] } { T{ key-down f { S+ } "RETURN" } [ "\n" swap user-input ] } @@ -92,8 +96,8 @@ editor H{ { T{ key-down f f "END" } [ T{ one-line-elt } editor-next ] } { T{ key-down f { S+ } "HOME" } [ T{ one-line-elt } editor-select-prev ] } { T{ key-down f { S+ } "END" } [ T{ one-line-elt } editor-select-next ] } - { T{ key-down f { C+ } "HOME" } [ T{ doc-elt } editor-prev ] } - { T{ key-down f { C+ } "END" } [ T{ doc-elt } editor-next ] } + { T{ key-down f { C+ } "HOME" } [ editor-doc-start ] } + { T{ key-down f { C+ } "END" } [ editor-doc-end ] } { T{ key-down f { C+ S+ } "HOME" } [ T{ doc-elt } editor-select-prev ] } { T{ key-down f { C+ S+ } "END" } [ T{ doc-elt } editor-select-next ] } { T{ key-down f f "DELETE" } [ T{ char-elt } editor-delete ] } diff --git a/library/ui/text/field.factor b/library/ui/text/field.factor index 78ae7e74fd..437bc4a231 100644 --- a/library/ui/text/field.factor +++ b/library/ui/text/field.factor @@ -10,9 +10,9 @@ C: field ( model -- field ) [ set-field-model ] keep dup dup set-control-self ; -: field-prev control-model go-back ; +: field-prev dup control-model go-back editor-doc-end ; -: field-next control-model go-forward ; +: field-next dup control-model go-forward editor-doc-end ; : field-commit ( field -- string ) [ editor-text ] keep