Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • K KTextEditor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FrameworksFrameworks
  • KTextEditor
  • Merge requests
  • !230

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

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Ahmad Samir requested to merge work/ahmad/override-mode-hl into master Nov 24, 2021
  • Overview 1
  • Commits 2
  • Pipelines 6
  • Changes 1

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 Nov 25, 2021 by Ahmad Samir
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: work/ahmad/override-mode-hl