Skip to content

FileFilter: add line/column numbers to file urls; also match absolute paths

Ahmad Samir requested to merge work/ahmad/grep-output into master

Since there is no universal way to tell a text editor about line/column on the cli (each editor seems to have its own scheme), there is a profile option to let the user specify the command to use to open local text files, e.g.: /usr/bin/kate PATH:LINE:COLUMN /usr/bin/gedit +LINE:COLUMN PATH

then we replace PATH LINE and COLUMN to create the cmd to pass on to KIO::ApplicationLauncherJob.

Current use cases, opening a file at:

  • specific line, from the ouput of "grep -n": "path/to/some/file:123"
  • specific line/column, from the output of gcc compiler errors: "/path/to/file:123:123"
  • specific line, from the ouput of ctest, when there is a compilation error: "[/path/to/some/file(123)]"

Change the regex to also match absolute file paths, this is useful in general and also compilation errors usually use absolute file paths.

Tweak the regex matching text between two single/double quotes so that it doesn't match newline characters.

Port some usage of KRun to OpenUrlJob/ApplicationLauncherJob, bump minimum required KF5 version to 5.71 as that's where those classes were added to KIO.

Refactor the UI file to use QBoxLayouts, this way each related set of options can be put together, which makes future changes slightly easier.

Edited by Kurt Hindenburg

Merge request reports