File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed
src/main/kotlin/uk/co/ben_gibson/git/link/ui Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 3
3
# GitLink Changelog
4
4
5
5
## [ Unreleased]
6
+ - Fix line selection around collapsed code sections
6
7
7
8
## [ 4.0.4]
8
- - Add pipeline to handle URL logic
9
+ - Add pipeline to handle URL logic
9
10
- Fix typos
10
11
11
12
## [ 4.0.3]
Original file line number Diff line number Diff line change 4
4
pluginGroup = uk.co.ben_gibson.git.link
5
5
pluginName = GitLink
6
6
# SemVer format -> https://semver.org
7
- pluginVersion = 4.0.4
7
+ pluginVersion = 4.0.5
8
8
9
9
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
10
10
# for insight into build numbers and IntelliJ Platform versions.
Original file line number Diff line number Diff line change @@ -4,10 +4,20 @@ import com.intellij.openapi.editor.Editor
4
4
5
5
val Editor .lineSelection: LineSelection
6
6
get() {
7
- val primaryCaret = caretModel.primaryCaret
7
+ val caretStates = caretModel.caretsAndSelections
8
8
9
- val start = primaryCaret.selectionStartPosition.line + 1
10
- val end = primaryCaret.selectionEndPosition.line + 1
9
+ if (caretStates.size < 1 ) {
10
+ return LineSelection (caretModel.logicalPosition.line + 1 )
11
+ }
11
12
12
- return LineSelection (start, end)
13
+ val caretState = caretStates[0 ]
14
+
15
+ val start = caretState.selectionStart
16
+ val end = caretState.selectionEnd
17
+
18
+ if (start == null || end == null ) {
19
+ return LineSelection (caretModel.logicalPosition.line + 1 )
20
+ }
21
+
22
+ return LineSelection (start.line + 1 , end.line + 1 )
13
23
}
Original file line number Diff line number Diff line change 1
1
package uk.co.ben_gibson.git.link.ui
2
2
3
- data class LineSelection (val start : Int , val end : Int )
3
+ data class LineSelection (val start : Int , val end : Int ) {
4
+ constructor (start: Int ) : this (start, start)
5
+ }
You can’t perform that action at this time.
0 commit comments