open selected filename; open file to a given line number

63 views
Skip to first unread message

Shawn Rutledge

unread,
Apr 9, 2011, 12:46:39 AM4/9/11
to scite-i...@googlegroups.com
If I paste a gdb stack trace into a Scite buffer, it would be nice to have a way to quickly open any file that appears in the stack trace, and also go to the line number shown.  Altogether I noticed 3 things that could be improved to make this easier:

1) if the selection contains whitespace on the beginning or end, it could be stripped to get a valid filename
2) tilde could be expanded (just call wordexp on the filename)
3) if the filename is followed by colon and line number, Scite could go to that line number automatically

That would be useful on the command line too for that matter - if the given filename ends with colon and a line number, Scite could automatically go to the given line.  (If OTOH the file with the colon actually exists (on filesystems that support filenames with colons) it should of course open that file, and not interpret the part after the colon as a line number.)

Shawn Rutledge

unread,
Apr 9, 2011, 1:08:31 AM4/9/11
to scite-i...@googlegroups.com
Oops I guess it does go to the line number for "open selected file" but not on the command line.  I guess I just didn't get the selection quite right; stripping the leading space if I select it by accident would still help.

Neil Hodgson

unread,
Apr 16, 2011, 8:42:02 PM4/16/11
to scite-i...@googlegroups.com, Shawn Rutledge
Shawn Rutledge:

> Oops I guess it does go to the line number for "open selected file" but not
> on the command line.  I guess I just didn't get the selection quite right;
> stripping the leading space if I select it by accident would still help.

If you click in the file name and Open Selected File then it
extends the range to grab normal file characters. If you select a
range of text then it assumes you want exactly that range.

Neil

Shawn Rutledge

unread,
Oct 17, 2011, 9:10:08 AM10/17/11
to scite-i...@googlegroups.com
On Sat, Apr 9, 2011 at 6:46 AM, Shawn Rutledge
<shawn.t....@gmail.com> wrote:
> 3) if the filename is followed by colon and line number, Scite could go to
> that line number automatically
> That would be useful on the command line too for that matter - if the given
> filename ends with colon and a line number, Scite could automatically go to
> the given line.

That would still be a nice feature to have. I just found the Lua
script to fake it,

http://lua-users.org/wiki/SciteOpenToLine

but why couldn't it be a built-in feature? The Lua script leaves an
empty tab for the file:line, and then opens a new tab with the actual
file, because I suppose there is no way to script the closing of the
first (useless) tab. And it's extra trouble to install the script
everywhere.

Neil Hodgson

unread,
Oct 18, 2011, 3:22:26 AM10/18/11
to scite-i...@googlegroups.com
Shawn Rutledge:

> but why couldn't it be a built-in feature?

Extra interpretation of file names will clash with other peoples
needs such as file names containing ':'. There is a "goto" command
line option so just write a launcher script.

Neil

Shawn Rutledge

unread,
Oct 18, 2011, 4:31:39 AM10/18/11
to scite-i...@googlegroups.com

Yes that's good. In that case maybe a command-line option to place a
marker and select the text range would also be nice, as the lua script
does.

Reply all
Reply to author
Forward
0 new messages