patchThe GNU Bourne-Again SHell - Patches: patch #9835, Expose READLINE_MARK

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #9835: Expose READLINE_MARK

Submitted by:  Len Trigg <lenbok>
Submitted on:  Fri 19 Jul 2019 03:51:59 AM UTC  
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Open

Wed 29 Jan 2020 07:06:03 PM UTC, comment #2: 

Thanks for the suggestion. It's now in the devel branch.

Chet Ramey <chet>
Project Administrator
Fri 23 Aug 2019 04:01:27 AM UTC, comment #1: 

Any feedback on this patch?

Len Trigg <lenbok>
Fri 19 Jul 2019 03:51:59 AM UTC, original submission:  

Exposing READLINE_MARK in addition to the existing READLINE_POSITION makes it possible for the user to implement improved clipboard integration.

E.g.

# Save between mark and point to clipboard
_xkill_ring_save() {
    if [[ -z "${READLINE_MARK}" ]]; then
        # fallback for bash without READLINE_MARK, select whole line
        CLIP="${READLINE_LINE}"
    elif [[ "${READLINE_MARK}" -gt "${READLINE_POINT}" ]]; then
        LEN=$((READLINE_MARK - READLINE_POINT))
        CLIP="${READLINE_LINE:$READLINE_POINT:$LEN}"
    else
        LEN=$((READLINE_POINT - READLINE_MARK))
        CLIP="${READLINE_LINE:$READLINE_MARK:$LEN}"
    fi
    echo -n "${CLIP}" | xclip
}
bind -m emacs -x '"\ew": _xkill_ring_save'

If you like the idea I can have a crack at updating the documentation also.

Len Trigg <lenbok>

 

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by lenbok (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-29 chet StatusNone => Done
    2019-07-19 lenbok Attached File- => Added 0001-Expose-readline-mark-via-READLINE_MARK.patch, #47240

    Back to the top


    Powered by Savane 3.6