Skip to content

Commit 14cffd9

Browse files
committed
No bars added within chords or comment
No bars added within chords or comment
1 parent 670dd54 commit 14cffd9

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGES

+1
Original file line numberDiff line numberDiff line change
@@ -629,3 +629,4 @@ different panes. Tie/untie option added for notes. Broken rhythm
629629
- Fixed: Playing selection gave an error: AttributeError: 'bytes' object has no attribute 'encode' (https://github.com/jwdj/EasyABC/issues/69)
630630
- Fixed: Now automatic insertion of bars (|) only when no text is selected
631631
- Fixed: FluidSynth issues on 64 bit Mac (thanks Mark)
632+
- Fixed: No bars added within chords or comment

easy_abc.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
program_name = 'EasyABC ' + program_version
55

66
# Copyright (C) 2011-2014 Nils Liberg (mail: kotorinl at yahoo.co.uk)
7-
# Copyright (C) 2015-2021 Seymour Shlien (mail: [email protected]), Jan Wybren de Jong (jw_de_jong at yahoo dot com)
7+
# Copyright (C) 2015-2024 Seymour Shlien (mail: [email protected]), Jan Wybren de Jong (jw_de_jong at yahoo dot com)
88
#
99
# This program is free software: you can redistribute it and/or modify
1010
# it under the terms of the GNU Lesser General Public License as published by
@@ -6799,10 +6799,10 @@ def OnCharEvent(self, evt):
67996799
if is_inside_field:
68006800
evt.Skip()
68016801
return
6802-
6802+
is_inside_chord = self.position_is_in_chord(cur_pos)
68036803
at_end_of_line = not line[caret:].strip(' \r\n|:][')
68046804
use_typing_assist = self.mni_TA_active.IsChecked()
6805-
if use_typing_assist and in_music_code:
6805+
if use_typing_assist and in_music_code and not is_inside_chord:
68066806
if c == '-' and no_selection:
68076807
self.AddTextWithUndo('- ')
68086808
return
@@ -7160,7 +7160,11 @@ def replace_selection(self, text):
71607160
def position_is_music_code(self, position):
71617161
style_at = self.editor.GetStyleAt
71627162
return style_at(position) == self.styler.STYLE_DEFAULT \
7163-
and style_at(position-1) not in (self.styler.STYLE_EMBEDDED_FIELD_VALUE, self.styler.STYLE_EMBEDDED_FIELD)
7163+
and style_at(position-1) not in (self.styler.STYLE_EMBEDDED_FIELD_VALUE, self.styler.STYLE_EMBEDDED_FIELD, self.styler.STYLE_COMMENT_NORMAL)
7164+
7165+
def position_is_in_chord(self, position):
7166+
style_at = self.editor.GetStyleAt
7167+
return style_at(position-1) == self.styler.STYLE_CHORD
71647168

71657169
def OnKeyDownEvent(self, evt):
71667170
# temporary work-around for what seems to be a scintilla bug on Mac:

0 commit comments

Comments
 (0)