From kde-bugs-dist Fri Nov 30 21:26:56 2007 From: Dominic Battre Date: Fri, 30 Nov 2007 21:26:56 +0000 To: kde-bugs-dist Subject: [Bug 153197] New: Append Enter to Pipe to Terminal Message-Id: <20071130222655.153197.dominic () battre ! de> X-MARC-Message: https://marc.info/?l=kde-bugs-dist&m=119645801725195 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. http://bugs.kde.org/show_bug.cgi?id=153197 Summary: Append Enter to Pipe to Terminal Product: kate Version: unspecified Platform: Compiled Sources OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: NOR Component: general AssignedTo: kwrite-devel kde org ReportedBy: dominic battre de Version: (using KDE Devel) Installed from: Compiled sources Executive Summary: I would like the "Pipe to Terminal" command append a \n to the last line. This is the reasoning behind it: I am using kate to write scripts for R (http://www.r-project.org/). R runs in the terminal and I want to submit code from the file I am editing to R frequently. Suppose the R script contains these lines (just some example): a <- 1:10; print(a); print(rev(a)); Now you select the first two lines with the mouse cursor. This selects the following content (... shows what is highlighted): |a <- 1:10;.........................| |print(a); | |print(rev(a)); | i.e. the \n after "print(a);" is NOT selected. If I pipe this to the terminal, the last line is NOT executed. I have attached a patch that introduces a new action which does the same as "Pipe to Terminal" but unconditionally adds one \n. This helps me a lot. I see the following questions regarding the patch: - I am not sure whether there should be a second menu item (clutters the menu), but sometimes one might want to pipe only a part of a line (select the "rev(a)" part and pipe this) - a shortcut would be sufficient for me, as I would not use the menu anyway. - I am not sure what would be the best description for the command ("Pipe to Terminal and auto-confirm with Enter" is somewhat long). - One could add a configuration option of the plugin that sets whether \n should always be added or never, but that takes the flexibility. - One might be able to make the "Pipe to Terminal" action smarter: If the end-cursor is located at a EOL, a \n would be added, but I don't know how to do that.