Skip to content

If user didn't set them, don't override file type and highlighting modes detection

Ahmad Samir requested to merge work/ahmad/override-mode-hl into master

The way the code works is that openFile() detects the file type, then calls updateFileType(); however readSessionConfig() calls updateFileType() again with the file type and hl modes from the katemetainforc config, in that case if neither of these two modes was set by the user, let the auto-detected modes be used and don't override them with the default values (Normal, and 0 respectively).

To test:

  • create a new file, kate -n somebashscript
  • add the hashbang #!/usr/bin/bash
  • close and reopen the file
    before: the mode and hl would be Normal and 0
    after: they would be Bash and Bash as they should be

When reloading, don't override auto-detected hl mode if not set by user

This has similar logic to the previous commit. Also it matches what the code is already doing for the filetype mode (i.e. only set the old filetype mode if set by user).

To test:

  • create a new file, kate -n somefile
  • add a hashbang, #!/usr/bin/bash
  • reload the document
    before: the file type mode is changed to Bash, the highlighting stays as None
    after: both the file type and hl mode are set to Bash
Edited by Ahmad Samir

Merge request reports

Loading