diff options
author | pgen <p.gen.progs@gmail.com> | 2022-10-23 19:19:27 +0200 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2022-10-23 19:28:11 +0200 |
commit | 9b488c0c71348ab8914d2974cc1c5a87a5a4b93e (patch) | |
tree | b629a6a277325f6477cd1e18206bc63f6cbe1aeb | |
parent | 4068e3aede66cd47539b7d984898c799b016b8e7 (diff) |
Add a 'u' command to untag a tagged word
-rw-r--r-- | smenu.1 | 9 | ||||
-rw-r--r-- | smenu.c | 23 | ||||
-rw-r--r-- | tests/tagging/t0014.good | 15 | ||||
l--------- | tests/tagging/t0014.in | 1 | ||||
-rw-r--r-- | tests/tagging/t0014.tst | 4 | ||||
-rw-r--r-- | tests/tagging/t0015.good | 11 | ||||
l--------- | tests/tagging/t0015.in | 1 | ||||
-rw-r--r-- | tests/tagging/t0015.tst | 4 |
8 files changed, 65 insertions, 3 deletions
@@ -526,14 +526,17 @@ use the \fB-r\fP|\fB-auto_validate\fP option to change this behavior. When the tagging is activated by using the command line \fB-T\fP|\fB-tm\fP|\fB-tag\fP|\fB-tag_mode\fP or \fB-P\fP|\fB-pm\fP|\fB-pin\fP|\fB-pin_mode\fP option, then the -keys \fBt\fP, \fBT\fP, \fBINS\fP and \fBDEL\fP can be used to tag/untag -some words. -These tagged words will then be output on the standard output when +keys \fBt\fP, \fBu\fP, \fBT\fP, \fBU\fP, \fBINS\fP and \fBDEL\fP can be +used to tag/untag some words. +These tagged words will then be sent to the standard output when \fBENTER\fP is pressed. .TP \fBt\fP Tag/untag or Pin/unpin the word under the cursor (toggle). .TP +\fBu\fP +Untag or unpin the word under the cursor. +.TP \fBT\fP Tag or pin the matching words if any. .TP @@ -11575,6 +11575,29 @@ main(int argc, char * argv[]) goto special_cmds_when_searching; break; + case 'u': + /* u has been pressed to untag a word if */ + /* tagging is enabled. */ + /* """"""""""""""""""""""""""""""""""""" */ + if (search_mode == NONE) + { + if (toggles.taggable) + { + if (word_a[current].is_tagged) + { + word_a[current].is_tagged = 0; + tagged_words--; + + nl = disp_lines(&win, &toggles, current, count, search_mode, + &search_data, &term, last_line, tmp_word, + &langinfo); + } + } + } + else + goto special_cmds_when_searching; + break; + case 'T': /* T has been pressed to tag all matching words resulting */ /* from a previous search if tagging is enabled. */ diff --git a/tests/tagging/t0014.good b/tests/tagging/t0014.good new file mode 100644 index 0000000..904ec66 --- /dev/null +++ b/tests/tagging/t0014.good @@ -0,0 +1,15 @@ +$ OUT=$(smenu -c -P -N'b|d|g' -- t0014.in) + + a 1) b c 2) d +7:01 8:01 9:01 10:01 21:01 22:01 23:01 24:01 + e f 3) g h +12:07 14:01 15:01 16:01 17:01 26:04 + u j k l +5:04 +$ + +$ echo ":$OUT:" + +:u h: + +$ exit 0 diff --git a/tests/tagging/t0014.in b/tests/tagging/t0014.in new file mode 120000 index 0000000..0abc8f1 --- /dev/null +++ b/tests/tagging/t0014.in @@ -0,0 +1 @@ +data1
\ No newline at end of file diff --git a/tests/tagging/t0014.tst b/tests/tagging/t0014.tst new file mode 100644 index 0000000..8bca246 --- /dev/null +++ b/tests/tagging/t0014.tst @@ -0,0 +1,4 @@ +\S[150]\s[10]OUT=$(smenu -c -P -N'b|d|g' -- t0014.in) +\S[150]\s[50]jjuthuthtutuh\r +\S[150]\s[10]echo ":$\s[10]OUT:" +exit 0 diff --git a/tests/tagging/t0015.good b/tests/tagging/t0015.good new file mode 100644 index 0000000..d48f327 --- /dev/null +++ b/tests/tagging/t0015.good @@ -0,0 +1,11 @@ +$ OUT=$(smenu -T " " t0015.in) + +a b c d e f g h u j k l +6:04 8:07 10:04 14:04 +$ + +$ echo ":$OUT:" + +:d f h: + +$ exit 0 diff --git a/tests/tagging/t0015.in b/tests/tagging/t0015.in new file mode 120000 index 0000000..0abc8f1 --- /dev/null +++ b/tests/tagging/t0015.in @@ -0,0 +1 @@ +data1
\ No newline at end of file diff --git a/tests/tagging/t0015.tst b/tests/tagging/t0015.tst new file mode 100644 index 0000000..1ef5122 --- /dev/null +++ b/tests/tagging/t0015.tst @@ -0,0 +1,4 @@ +\S[150]\s[10]OUT=$(smenu -T " " t0015.in) +\S[150]\s[50]luututulltlultllthuhh\r +\S[150]\s[10]echo ":$\s[10]OUT:" +exit 0 |