https://bugs.kde.org/show_bug.cgi?id=457810

            Bug ID: 457810
           Summary: Smarter "pipe to terminal" action
           Product: kate
           Version: unspecified
          Platform: unspecified
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: general
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: m.mahmoud...@gmail.com
  Target Milestone: ---

## Summary

At the moment the "pipe to terminal" behaves very primitively, and I'm
suggesting a more advanced and modern way of working.

## Current behavior

At the moment, if a text is selected, it would be sent to the terminal. I no
text was selected, it will send the whole content of the file. This is somewhat
equivalent of `eval-region` and `eval-buffer` in Emacs, except it sends the
strings to the terminal blindly and with a universal warning regardless of the
state of the terminal.

## Proposal

### Context awareness

The only usage of sending anything to terminal/console is for interpretative
languages that has some sort of REPL. For compiling languages this feature is
totally useless. For this reason, it would be nice that Kate is context aware
and shows warning if terminal is not in a REPL mode.

### Smarter sending

When scripting in any interpretative language, there are three type of running
a user would like to do:
1. sending the selection
2. sending the current line or block
3. sending the whole file

The first type is very obvious, if a text was selected, only and only send that
string. But if no text was not selected, send the line or block. Deciding if to
send a line or block is actually very simple as it is already in Kate. If the
current line is foldable (i.e in the gutter near the line number it has the
triangle to fold it), run the whole block, if not, run the line.

As for the third type, usually a different key binding is used in all text
editors and IDEs I have seen.

### Step forward

usually when someone is running a script line-by-line (or block-by-block), they
want to run it, and move the cursor to the end of the next non-empty line to be
able to run that. In many IDEs and editors, there are two keybindings, one that
steps forward, and one that keeps the cursor at where it was. I personally
almost never used/needed the latter and I have exclusively used the former.

I will be happy to elaborate more if something in your opinion is missing or if
the picture I'm trying to paint here is vague and unclear.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to