zsh-workers
 help / color / mirror / code / Atom feed
* Re: [vi-mode] widgets for case manipulation: `gU` and `U` in visual mode
       [not found]         ` <25350.1466608182@thecus.kiddle.eu>
@ 2016-06-22 17:29           ` Bart Schaefer
  2016-06-22 19:57             ` Oliver Kiddle
       [not found]           ` <CAEwkUWOAvbT4xydtG6EZYRS3tOuur1LZ3tJAx97jR8zgFBjsyw@mail.gmail.com>
  1 sibling, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2016-06-22 17:29 UTC (permalink / raw)
  To: zsh-workers

[>workers]

On Jun 22,  5:09pm, Oliver Kiddle wrote:
}
} > On Wed, Jun 22, 2016 at 10:19 AM, Filipe Silva <filipe.silva@gmail.com>
} > wrote:
} > > I've fixed the bug including the following condition:
} 
} Thanks for that!

I think the "surround" widget and/or select-{bracketed.quoted} have the
same problem:

- follow recommended instructions to load "surround" and to bindkey ys
- enter abcde on the command line
- hit ESC h h to move to the "c"
- type y s b (
- end up with c(ab)de on the line, expected (ab)cde


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [vi-mode] widgets for case manipulation: `gU` and `U` in visual mode
  2016-06-22 17:29           ` [vi-mode] widgets for case manipulation: `gU` and `U` in visual mode Bart Schaefer
@ 2016-06-22 19:57             ` Oliver Kiddle
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2016-06-22 19:57 UTC (permalink / raw)
  To: zsh-workers; +Cc: Filipe Silva

Bart wrote:
>
> I think the "surround" widget and/or select-{bracketed.quoted} have the
> same problem:

> - end up with c(ab)de on the line, expected (ab)cde

Yes. Thanks. This should correct that and the ksharrays point you also
made.

Oliver

diff --git a/Functions/Zle/select-bracketed b/Functions/Zle/select-bracketed
index 00f51be..d467bb8 100644
--- a/Functions/Zle/select-bracketed
+++ b/Functions/Zle/select-bracketed
@@ -12,6 +12,8 @@
 #	done
 #     done
 
+setopt localoptions noksharrays
+
 local style=${${1:-$KEYS}[1]} matching="(){}[]<>bbBB"
 local -i find=${NUMERIC:-1} idx=${matching[(I)[${${1:-$KEYS}[2]}]]}%9
 (( idx )) || return 1 # no corresponding closing bracket
diff --git a/Functions/Zle/surround b/Functions/Zle/surround
index b7be30b..8b9ba20 100644
--- a/Functions/Zle/surround
+++ b/Functions/Zle/surround
@@ -69,7 +69,11 @@ case $WIDGET in
       before="${(k)matching[(r)[$before:q]]}"
     fi
     CUTBUFFER="$before$CUTBUFFER$after"
-    zle .vi-put-after -n 1
+    if (( CURSOR )); then
+      zle .vi-put-after -n 1
+    else
+      zle .vi-put-before -n 1
+    fi
     CUTBUFFER="$save_cut" CURSOR="$save_cur"
   ;;
 esac


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Widget musings
       [not found]                   ` <27903.1466634569@thecus.kiddle.eu>
@ 2016-06-23  4:52                     ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2016-06-23  4:52 UTC (permalink / raw)
  To: zsh-workers

[>workers]

On Jun 22, 10:11pm, Oliver Kiddle wrote:
} 
} I've just noticed that we also need to account for the cursor being at
} the beginning of a line other than the first one

"Cursor is at [beginning, end] of a line" seems to be a pretty common
thing to want to test.  Maybe the zsh/zleparameter module should define
some condition codes so one could write stuff like

	if [[ -bol CURSOR && -eol MARK ]]; then

Aside:  The zsh/complete module defines -prefix -suffix -between and
-after but only -prefix is ever used by the shell code.

On Jun 23, 12:29am, Oliver Kiddle wrote:
}
} The custom cutbuffer widget is not marked as being a vi operator so gets
} invoked as soon as you press y. Currently, I can't think of an easy fix
} for this.

Per recent discussion about why add-zle-hook-widget is not suitable for
"non-special" widgets:  Part of the criteria for an action-widget hook
should be that flags on the hook'd widget, such as "is a vi operator",
persist across execution of the hook.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-25 20:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAEwkUWMnBO7_6EOo5y5b1eMAZB6uXkgXsh51OqtuEbbUQQPRyQ@mail.gmail.com>
     [not found] ` <21997.1466550647@thecus.kiddle.eu>
     [not found]   ` <160621234233.ZM10369@torch.brasslantern.com>
     [not found]     ` <CAEwkUWM0O2Wzh1rYPUK4HU3P5MxZHJnA-5NT+Mow_3oMQbtwag@mail.gmail.com>
     [not found]       ` <CAEwkUWNw=oYJs7NV7c8ZTQp+j6CHrtUsDEcMaH+vVVWpdEof_w@mail.gmail.com>
     [not found]         ` <25350.1466608182@thecus.kiddle.eu>
2016-06-22 17:29           ` [vi-mode] widgets for case manipulation: `gU` and `U` in visual mode Bart Schaefer
2016-06-22 19:57             ` Oliver Kiddle
     [not found]           ` <CAEwkUWOAvbT4xydtG6EZYRS3tOuur1LZ3tJAx97jR8zgFBjsyw@mail.gmail.com>
     [not found]             ` <26676.1466626292@thecus.kiddle.eu>
     [not found]               ` <CAEwkUWPHhDKyzfAUmZaTFGcaW3NOyE_uWTR4Nk1KD0=8jgiFhA@mail.gmail.com>
     [not found]                 ` <CAEwkUWMwSBQhhuQHVOjNqqGUce40kN5f1thvGTriWDo2YB++Cg@mail.gmail.com>
     [not found]                   ` <27903.1466634569@thecus.kiddle.eu>
2016-06-23  4:52                     ` Widget musings Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).