Skip to content

Commit

Permalink
- Added Noninclusive marking mode toggle command (Alt+A).
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdawenterprises committed Feb 16, 2024
1 parent 521a064 commit 2c2d306
Show file tree
Hide file tree
Showing 10 changed files with 315 additions and 271 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ for some commands (Column Marking Mode, and Right side of window) to work proper
<tr><td>Alt + M</td><td>Mark toggle</td><td>Toggle normal marking mode. Use cursor or single click mouse to move cursor and expand selection.</td></tr>
<tr><td>Alt + L</td><td>Line Mark toggle</td><td>Toggle line marking mode. Use cursor or single click mouse to move cursor and expand selection.</td></tr>
<tr><td>Alt + C</td><td>Column Mark toggle<sup>*</sup></td><td>Toggle column marking mode. Use cursor or single click mouse to move cursor and expand selection.</td></tr>
<tr><td>Alt + A</td><td>Noninclusive Mark toggle</td><td>Equivalent to Mark, except that the marked area does not include the character at the end of the block. Essentially begins the marking mode with no visible selection, unlike Mark which automatically selects the first character.</td></tr>
<tr><td>Alt + <i>[1-10]</i></td><td>Drop bookmark</td><td>Inserts a numbered (1-10) bookmark into the editor and the current cursor posiotion. Bookmark 10 is dropped using the 0 key. This uses the built-in "toggle bookmark" commands.</td></tr>
<tr><td>Alt + J, <i>[1-10]</i></td><td>Jump to bookmark</td><td>Waits for a bookmark number (waits only for the default 2 seconds), <i>[1-10]</i> then jumps to that number. Bookmark 10 is the 0 key.</td></tr>
<tr><td>Alt + B</td><td>Bookmark List</td><td>Open bookmark list dialog. Scroll and select a bookmark to jump to. Can also delete bookmarks. This is a new command and the key assignment was taken from the "buffer list" command, which is not implemented.</td></tr>
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pluginGroup = net.ddns.rkdawenterprises
pluginName = brief4ijidea

# SemVer format -> https://semver.org
pluginVersion = 1.0.12
pluginVersion = 1.1.0

# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
platformType = IC
Expand All @@ -14,7 +14,7 @@ platformType = IC
# https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#intellij-platform-based-products-of-recent-ide-versions
# https://www.jetbrains.com/idea/download/other.html
# 233
platformVersion = 2023.3.2
platformVersion = 2023.3.4
# 232
#platformVersion = 2023.2.5
# 231
Expand Down
453 changes: 219 additions & 234 deletions src/main/java/net/ddns/rkdawenterprises/brief4ijidea/Marking_component.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ fun editor_lost_focus(editor: Editor)
false)
}

fun toggle_marking_mode(editor: Editor)
fun toggle_marking_mode(editor: Editor, is_noninclusive: Boolean = false)
{
Line_marking_component.stop_line_marking_mode(editor,
true)
Column_marking_component.stop_column_marking_mode(editor,
true)
Marking_component.toggle_marking_mode(editor)
Marking_component.toggle_marking_mode(editor, is_noninclusive)
}

fun toggle_line_marking_mode(editor: Editor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void actionPerformed( @NotNull AnActionEvent e )
( caret_position.line <= visible_area_top_alternate_beginning_of_line_position.line ) ) && ( caret_position.column == 0 );
if( at_window_start )
{
if( Marking_component.is_marking_mode() )
if( Marking_component.INSTANCE.is_marking_mode() )
{
do_action( "EditorTextStartWithSelection", e );
return;
Expand All @@ -110,7 +110,7 @@ public void actionPerformed( @NotNull AnActionEvent e )
boolean at_line_start = ( caret_position.column == 0 ) || Line_marking_component.is_line_marking_mode();
if( at_line_start )
{
if( Marking_component.is_marking_mode() )
if( Marking_component.INSTANCE.is_marking_mode() )
{
do_action( "EditorMoveToPageTopWithSelection", e );
return;
Expand All @@ -134,15 +134,15 @@ public void actionPerformed( @NotNull AnActionEvent e )
{
EditorActionUtil.moveCaretToLineStartIgnoringSoftWraps( editor );
EditorModificationUtil.scrollToCaret( editor );
if( Marking_component.is_marking_mode() )
if( Marking_component.INSTANCE.is_marking_mode() )
{
Marking_component.marking_post_handler( editor,
KeyEvent.VK_HOME );
}
}
else
{
if( Marking_component.is_marking_mode() )
if( Marking_component.INSTANCE.is_marking_mode() )
{
do_action( "EditorLineStartWithSelection", e );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void actionPerformed( @NotNull AnActionEvent e )
( caret_visual_position.line == visible_area_bottom_end_of_line_position.line ) );
if( at_window_end )
{
if( Marking_component.is_marking_mode() )
if( Marking_component.INSTANCE.is_marking_mode() )
{
do_action( "EditorTextEndWithSelection", e );
return;
Expand Down Expand Up @@ -134,7 +134,7 @@ public void actionPerformed( @NotNull AnActionEvent e )
( caret_logical_position.line != last_line_number ) );
if( at_line_end )
{
if( Marking_component.is_marking_mode() )
if( Marking_component.INSTANCE.is_marking_mode() )
{
do_action( "EditorMoveToPageBottomWithSelection", e );
return;
Expand All @@ -155,7 +155,7 @@ public void actionPerformed( @NotNull AnActionEvent e )
return;
}

if( Marking_component.is_marking_mode() )
if( Marking_component.INSTANCE.is_marking_mode() )
{
do_action( "EditorLineEndWithSelection", e );
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
* Copyright (c) 2019-2022 RKDAW Enterprises and Ralph Williamson
*
Expand All @@ -15,37 +14,39 @@
* limitations under the License.
*/

package net.ddns.rkdawenterprises.brief4ijidea.actions;
@file:Suppress("ClassName",
"FunctionName",
"RedundantSemicolon",
"PrivatePropertyName",
"LocalVariableName",
"PropertyName",
"PackageName",
"UnnecessaryVariable",
"ArrayInDataClass",
"ComponentNotRegistered")

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.Editor;
import org.jetbrains.annotations.NotNull;
package net.ddns.rkdawenterprises.brief4ijidea.actions

import static net.ddns.rkdawenterprises.brief4ijidea.MiscellaneousKt.toggle_marking_mode;
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import net.ddns.rkdawenterprises.brief4ijidea.toggle_marking_mode

@SuppressWarnings({ "ComponentNotRegistered", "unused" })
public class Mark_action
extends Plugin_action
@Suppress("unused")
class Mark_action
(text: String?,
description: String?) : Plugin_action(text,
description)
{
public Mark_action( String text,
String description )
{
super( text,
description );
}

/**
* Implement this method to provide your action handler.
*
* @param e Carries information on the invocation place
*/
@Override
public void actionPerformed( @NotNull AnActionEvent e )
override fun actionPerformed(e: AnActionEvent)
{
Editor editor = e.getData( CommonDataKeys.EDITOR );
if( editor == null ) return;
val editor = e.getData(CommonDataKeys.EDITOR)
?: return

toggle_marking_mode( editor );
toggle_marking_mode(editor);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2019-2022 RKDAW Enterprises and Ralph Williamson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress("ClassName",
"FunctionName",
"RedundantSemicolon",
"PrivatePropertyName",
"LocalVariableName",
"PropertyName",
"PackageName",
"UnnecessaryVariable",
"ArrayInDataClass",
"ComponentNotRegistered")

package net.ddns.rkdawenterprises.brief4ijidea.actions

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import net.ddns.rkdawenterprises.brief4ijidea.toggle_marking_mode

@Suppress("unused")
class Noninclusive_mark_action
(text: String?,
description: String?) : Plugin_action(text,
description)
{
/**
* Implement this method to provide your action handler.
*
* @param e Carries information on the invocation place
*/
override fun actionPerformed(e: AnActionEvent)
{
val editor = e.getData(CommonDataKeys.EDITOR)
?: return

toggle_marking_mode(editor, true);
}
}
11 changes: 8 additions & 3 deletions src/main/resources/keymaps/Brief.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,26 @@

<!-- Blocks and marks -->

<!-- Command: Mark. Description: Starts normal marking mode. -->
<!-- Command: Mark. Description: Toggle normal marking mode. -->
<action id="net.ddns.rkdawenterprises.brief4ijidea.actions.mark">
<keyboard-shortcut first-keystroke="alt M"/>
</action>

<!-- Command: Line mark. Description: Starts marking a line at a time. -->
<!-- Command: Line mark. Description: Toggle marking a line at a time. -->
<action id="net.ddns.rkdawenterprises.brief4ijidea.actions.line_mark">
<keyboard-shortcut first-keystroke="alt L"/>
</action>

<!-- Command: Column mark. Description: Starts marking a rectangular block. -->
<!-- Command: Column mark. Description: Toggle marking a rectangular block. -->
<action id="net.ddns.rkdawenterprises.brief4ijidea.actions.column_mark">
<keyboard-shortcut first-keystroke="alt C"/>
</action>

<!-- Command: Noninclusive mark. Description: Toggle Noninclusive Mark mode. -->
<action id="net.ddns.rkdawenterprises.brief4ijidea.actions.noninclusive_mark">
<keyboard-shortcut first-keystroke="alt A"/>
</action>

<!-- Command: Drop bookmark 10. Description: Drops a numbered bookmark at the current position. -->
<action id="net.ddns.rkdawenterprises.brief4ijidea.actions.drop_bookmark_10">
<keyboard-shortcut first-keystroke="alt 0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import com.intellij.remoterobot.utils.waitFor
import net.ddns.rkdawenterprises.brief4ijidea.pages.DialogFixture
import net.ddns.rkdawenterprises.brief4ijidea.pages.DialogFixture.Companion.byTitle
import net.ddns.rkdawenterprises.brief4ijidea.pages.IdeaFrame
import org.apache.commons.lang.StringUtils
import org.apache.commons.lang3.StringUtils
import java.awt.Point
import java.time.Duration

Expand Down

0 comments on commit 2c2d306

Please sign in to comment.