[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [PATCH] Pipe selected text to external tool
From: |
Marco Diego Aurélio Mesquita |
Subject: |
Re: [Nano-devel] [PATCH] Pipe selected text to external tool |
Date: |
Sat, 17 Feb 2018 13:36:40 -0200 |
On Sat, Feb 17, 2018 at 3:52 AM, Brand Huntsman <address@hidden> wrote:
> On Fri, 16 Feb 2018 21:55:12 -0700
> Brand Huntsman <address@hidden> wrote:
>
>> The cutbuffer has an empty line at the end if cursor is the start of
>> the next line. send_data() needs to detect this and not send that
>> final line. And if the cutbuffer doesn't contain that empty line,
>> then don't send a linefeed on the last line.
>
> An additional problem is that some programs will send the last line back to
> nano with a linefeed.
>
> `sed s:match:foo:g` does not
> `grep small` does
>
> So grep will work fine if cursor is on the next line, but a blank line is
> added if cursor is at the end of the last line. If that final blank line is
> removed from cutbuffer, then return true from send_data(). If return value is
> false, then remove last character returned from command if it is a linefeed.
>
Attached patch seems to do the trick. Please test it.
0001-Pipe-slected-text-to-external-command.patch
Description: Text Data
[Nano-devel] how should piping through an external command work?, Benno Schulenberg, 2018/02/18
Re: [Nano-devel] how should piping through an external command work?, Brand Huntsman, 2018/02/18
Re: [Nano-devel] how should piping through an external command work?, Benno Schulenberg, 2018/02/19
[Nano-devel] Fwd: Re: how should piping through an external command work?, Benno Schulenberg, 2018/02/19
Re: [Nano-devel] Fwd: Re: how should piping through an external command work?, Brand Huntsman, 2018/02/19