Micropython-Editor icon indicating copy to clipboard operation
Micropython-Editor copied to clipboard

return selected string - enhancement

Open DG12 opened this issue 3 years ago • 3 comments

It would be useful to return the selected string OR clipboard on exit.

Usage: >>> pye('troubled.py') ... select source line with complicated syntax (maybe copy to clipboard) and/or multiple lines with indents.

Example:

            start_line, start_col, end_line, end_col = self.mark_range()
            start_col = max(start_col - self.margin, 0)
            end_col = max(end_col - self.margin, 0)

^q (( Maybe ask "return selection/clipboard/filename (s,c,f): ))

>>> ^v (paste to REPL)
>>> print(.format "{ I left out the closing brace.", variable)

Removing leading indent!

Normal copy paste will include indents and be unacceptable for REPL

DG12 avatar Sep 02 '22 12:09 DG12

I'm not going to add a question beyond the existing one to the QUIT action. At the moment, pye either returns the file name or the editor content, if no file name exists. The latter may be more useful than returning the file name. What I do when I require a line from a file is:

  • open the file in pye and scroll it, until the part I need is in the window.
  • close the file and use the terminal's cut and paste.

So given that I almost ever ignore the return value of pye, I do not see any benefit in changing the return value. The only useful change I see is to return None.

robert-hh avatar Sep 15 '22 09:09 robert-hh

After further thought and simulation this won't work as I hoped any way.

What do you use a an IDE ?

DG12 avatar Sep 16 '22 22:09 DG12

What do you use a an IDE ?

No IDE. I use just simple terminal emulators, most of the time picocom at Linux and OS/X, Putty or TeraTerm at Windows and sometimes tio with Linux. That was one of the reasons for starting pye. I do not like these IDE. Too much magic behind the scene, which is nice as long as it works, and a horror, if not. With PC editors, I just moved from VSC to Sublime Text. It looks less shiny, but works better for coding. It just took a while to get it configured for best readability.

robert-hh avatar Sep 17 '22 06:09 robert-hh

Thank you very much.

Is there a package that you use for simple file management: delete , move, copy? I am working on a very simple one but why should I bother If there already is one.

DG12 avatar Sep 18 '22 12:09 DG12

On the board from REPL I use upysh.py, for controlling from the PC I use mpremote or at devices with WiFi ftp (e.g. FileZilla).

robert-hh avatar Sep 18 '22 18:09 robert-hh

Thank you.

DG12 avatar Sep 19 '22 11:09 DG12