mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-08 06:34:08 +02:00
Reformat code
This commit is contained in:
parent
36556d559f
commit
ad584d553c
src
main
java/com/maddyhome/idea/vim
VimPlugin.javaVimTypedActionHandler.kt
action
command
common
ex
extension
group
ChangeGroup.ktEditorGroup.javaHistoryGroup.javaIjOptionProperties.ktIjOptions.ktIjVimPsiService.ktIjVimStorageService.ktKeyGroup.javaMotionGroup.ktNotificationService.ktOptionGroup.ktProcessGroup.ktRegisterGroup.javaVimJumpServiceImpl.ktVimMarkServiceImpl.ktWindowGroup.java
copy
visual
handler
helper
CaretVisualAttributesHelper.ktEditorHelper.javaHandlerInjector.ktIjActionExecutor.ktSearchHelperKt.ktSearchHighlightsHelper.ktUndoRedoHelper.ktUserDataManager.kt
listener
mark
newapi
IjClipboardManager.ktIjVimCaret.ktIjVimEditor.ktIjVimMessages.ktIjVimSearchGroup.ktIjVimSearchHelper.kt
statistic
ui
ExOutputPanel.javaStatusBar.ktVimEmulationConfigurable.kt
ex
ExDocument.javaExEditorKit.ktExEntryPanel.javaExEntryPanelService.ktExShortcutKeyAction.ktExTextField.java
widgets/mode
vimscript
resources
test/java/org/jetbrains/plugins/ideavim/action
CopyActionTest.ktMacroActionTest.ktMacroWithEditingTest.ktMotionActionTest.ktMultipleCaretsTest.kt
change
copy
IdeaPutNotificationsTest.ktPutTestAfterCursorActionTest.ktPutTextBeforeCursorActionTest.ktPutViaIdeaTest.ktPutVisualTextActionTest.ktPutVisualTextMoveCursorActionTest.ktYankAndPutTest.ktYankMotionActionTest.ktYankVisualLinesActionTest.kt
motion
@ -215,7 +215,8 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
||||
|
||||
if (enabled) {
|
||||
VimInjectorKt.getInjector().getListenersNotifier().notifyPluginTurnedOn();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
VimInjectorKt.getInjector().getListenersNotifier().notifyPluginTurnedOff();
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,12 @@ class VimTypedActionHandler(origHandler: TypedActionHandler) : TypedActionHandle
|
||||
LOG.trace("Before execute for typed action")
|
||||
if (editor.isIdeaVimDisabledHere) {
|
||||
LOG.trace("IdeaVim disabled here, finish")
|
||||
(KeyHandlerKeeper.getInstance().originalHandler as? TypedActionHandlerEx)?.beforeExecute(editor, charTyped, context, plan)
|
||||
(KeyHandlerKeeper.getInstance().originalHandler as? TypedActionHandlerEx)?.beforeExecute(
|
||||
editor,
|
||||
charTyped,
|
||||
context,
|
||||
plan
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -205,6 +205,7 @@ class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible*/ {
|
||||
ShortcutOwner.VIM -> {
|
||||
return ActionEnableStatus.yes("Owner is vim", LogLevel.DEBUG)
|
||||
}
|
||||
|
||||
ShortcutOwner.IDE -> {
|
||||
if (!isShortcutConflict(keyStroke)) {
|
||||
ActionEnableStatus.yes("Owner is IDE, but no actionve shortcut conflict", LogLevel.DEBUG)
|
||||
@ -212,6 +213,7 @@ class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible*/ {
|
||||
ActionEnableStatus.no("Owner is IDE", LogLevel.DEBUG)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (isShortcutConflict(keyStroke)) {
|
||||
savedShortcutConflicts[keyStroke] = ShortcutOwnerInfo.allUndefined
|
||||
@ -224,7 +226,8 @@ class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible*/ {
|
||||
}
|
||||
|
||||
private fun isEnabledForEscape(editor: Editor): Boolean {
|
||||
val ideaVimSupportDialog = injector.globalIjOptions().ideavimsupport.contains(IjOptionConstants.ideavimsupport_dialog)
|
||||
val ideaVimSupportDialog =
|
||||
injector.globalIjOptions().ideavimsupport.contains(IjOptionConstants.ideavimsupport_dialog)
|
||||
return editor.isPrimaryEditor() ||
|
||||
EditorHelper.isFileEditor(editor) && !editor.vim.mode.inNormalMode ||
|
||||
ideaVimSupportDialog && !editor.vim.mode.inNormalMode
|
||||
|
@ -37,7 +37,12 @@ import com.maddyhome.idea.vim.vimscript.model.expressions.FunctionCallExpression
|
||||
import com.maddyhome.idea.vim.vimscript.model.expressions.SimpleExpression
|
||||
|
||||
// todo make it multicaret
|
||||
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, motionType: SelectionType): Boolean {
|
||||
private fun doOperatorAction(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
textRange: TextRange,
|
||||
motionType: SelectionType,
|
||||
): Boolean {
|
||||
val func = injector.globalOptions().operatorfunc
|
||||
if (func.isEmpty()) {
|
||||
VimPlugin.showMessage(MessageHelper.message("E774"))
|
||||
@ -61,8 +66,7 @@ private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textR
|
||||
// Get the argument for function('...') or funcref('...') for the error message
|
||||
val functionName = if (expression is FunctionCallExpression && expression.arguments.isNotEmpty()) {
|
||||
expression.arguments[0].evaluate(editor, context, scriptContext).toString()
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
func
|
||||
}
|
||||
|
||||
@ -100,7 +104,12 @@ internal class OperatorAction : VimActionHandler.SingleExecution() {
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
||||
override fun execute(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Boolean {
|
||||
val argument = cmd.argument as? Argument.Motion ?: return false
|
||||
if (!editor.inRepeatMode) {
|
||||
argumentCaptured = argument
|
||||
|
@ -23,7 +23,12 @@ import com.maddyhome.idea.vim.newapi.ij
|
||||
internal class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_WRITABLE
|
||||
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
||||
override fun execute(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Boolean {
|
||||
val state = injector.vimState
|
||||
var lastCommand = VimRepeater.lastChangeCommand
|
||||
|
||||
|
@ -38,7 +38,7 @@ internal class VimEditorDown : IdeActionHandler(IdeActions.ACTION_EDITOR_MOVE_CA
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
operatorArguments: OperatorArguments
|
||||
operatorArguments: OperatorArguments,
|
||||
): Boolean {
|
||||
val undo = injector.undo
|
||||
when (undo) {
|
||||
@ -67,7 +67,7 @@ internal class VimEditorUp : IdeActionHandler(IdeActions.ACTION_EDITOR_MOVE_CARE
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
operatorArguments: OperatorArguments
|
||||
operatorArguments: OperatorArguments,
|
||||
): Boolean {
|
||||
val undo = injector.undo
|
||||
when (undo) {
|
||||
@ -85,7 +85,12 @@ internal class VimEditorUp : IdeActionHandler(IdeActions.ACTION_EDITOR_MOVE_CARE
|
||||
internal class VimQuickJavaDoc : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_READONLY
|
||||
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
||||
override fun execute(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Boolean {
|
||||
injector.actionExecutor.executeAction(editor, IdeActions.ACTION_QUICK_JAVADOC, context)
|
||||
return true
|
||||
}
|
||||
|
@ -36,19 +36,21 @@ class CommandState(private val machine: VimStateMachine) {
|
||||
}
|
||||
}
|
||||
|
||||
@get:Deprecated("Use `KeyHandler.keyHandlerState.commandBuilder", ReplaceWith(
|
||||
"KeyHandler.getInstance().keyHandlerState.commandBuilder",
|
||||
"com.maddyhome.idea.vim.KeyHandler"
|
||||
)
|
||||
@get:Deprecated(
|
||||
"Use `KeyHandler.keyHandlerState.commandBuilder", ReplaceWith(
|
||||
"KeyHandler.getInstance().keyHandlerState.commandBuilder",
|
||||
"com.maddyhome.idea.vim.KeyHandler"
|
||||
)
|
||||
)
|
||||
@get:ApiStatus.ScheduledForRemoval
|
||||
val commandBuilder: CommandBuilder
|
||||
get() = KeyHandler.getInstance().keyHandlerState.commandBuilder
|
||||
|
||||
@Deprecated("Use `KeyHandler.keyHandlerState.mappingState", ReplaceWith(
|
||||
"KeyHandler.getInstance().keyHandlerState.mappingState",
|
||||
"com.maddyhome.idea.vim.KeyHandler"
|
||||
)
|
||||
@Deprecated(
|
||||
"Use `KeyHandler.keyHandlerState.mappingState", ReplaceWith(
|
||||
"KeyHandler.getInstance().keyHandlerState.mappingState",
|
||||
"com.maddyhome.idea.vim.KeyHandler"
|
||||
)
|
||||
)
|
||||
val mappingState: MappingState
|
||||
get() = KeyHandler.getInstance().keyHandlerState.mappingState
|
||||
|
@ -14,7 +14,7 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings.IndentOptions
|
||||
import com.maddyhome.idea.vim.api.VimIndentConfig
|
||||
|
||||
internal class IndentConfig private constructor(indentOptions: IndentOptions): VimIndentConfig {
|
||||
internal class IndentConfig private constructor(indentOptions: IndentOptions) : VimIndentConfig {
|
||||
private val indentSize = indentOptions.INDENT_SIZE
|
||||
private val tabSize = indentOptions.TAB_SIZE
|
||||
private val isUseTabs = indentOptions.USE_TAB_CHARACTER
|
||||
|
@ -127,8 +127,7 @@ class ExOutputModel(private val myEditor: WeakReference<Editor>) : VimOutputPane
|
||||
override fun close() {
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode) {
|
||||
editor?.let { ExOutputPanel.getInstance(it).close() }
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
isActiveInTestMode = false
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public interface VimExtension {
|
||||
* let g:exchange_no_mappings=1
|
||||
* ```
|
||||
* Here the user will expect that the exchange plugin won't have default mappings. However, if we load vim-exchange
|
||||
* immediately, this variable won't be initialized at the moment of plugin initialization.
|
||||
* immediately, this variable won't be initialized at the moment of plugin initialization.
|
||||
* <p>
|
||||
* There is also a tricky case for mappings override:
|
||||
* ```
|
||||
@ -48,8 +48,8 @@ public interface VimExtension {
|
||||
* map X <Plug>(ExchangeLine)
|
||||
* ```
|
||||
* For this case, a plugin with a good implementation detects that there is already a defined mapping for
|
||||
* `<Plug>(ExchangeLine)` and doesn't register the default cxx mapping. However, such detection requires the mapping
|
||||
* to be defined before the plugin initialization.
|
||||
* `<Plug>(ExchangeLine)` and doesn't register the default cxx mapping. However, such detection requires the mapping
|
||||
* to be defined before the plugin initialization.
|
||||
*/
|
||||
void init();
|
||||
|
||||
|
@ -69,7 +69,8 @@ object VimExtensionFacade {
|
||||
|
||||
|
||||
@JvmStatic
|
||||
@Deprecated("Use VimPlugin.getKey().putKeyMapping(modes, fromKeys, pluginOwner, extensionHandler, recursive)",
|
||||
@Deprecated(
|
||||
"Use VimPlugin.getKey().putKeyMapping(modes, fromKeys, pluginOwner, extensionHandler, recursive)",
|
||||
ReplaceWith(
|
||||
"VimPlugin.getKey().putKeyMapping(modes, fromKeys, pluginOwner, extensionHandler, recursive)",
|
||||
"com.maddyhome.idea.vim.VimPlugin"
|
||||
@ -189,12 +190,18 @@ object VimExtensionFacade {
|
||||
/** Get the current contents of the given register similar to 'getreg()'. */
|
||||
@JvmStatic
|
||||
fun getRegister(editor: VimEditor, register: Char): List<KeyStroke>? {
|
||||
val reg = VimPlugin.getRegister().getRegister(editor, injector.executionContextManager.getEditorExecutionContext(editor), register) ?: return null
|
||||
val reg = VimPlugin.getRegister()
|
||||
.getRegister(editor, injector.executionContextManager.getEditorExecutionContext(editor), register) ?: return null
|
||||
return reg.keys
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getRegisterForCaret(editor: VimEditor, context: ExecutionContext, register: Char, caret: VimCaret): List<KeyStroke>? {
|
||||
fun getRegisterForCaret(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
register: Char,
|
||||
caret: VimCaret,
|
||||
): List<KeyStroke>? {
|
||||
val reg = caret.registerStorage.getRegister(editor, context, register) ?: return null
|
||||
return reg.keys
|
||||
}
|
||||
@ -225,7 +232,7 @@ object VimExtensionFacade {
|
||||
defaultArgs: List<Pair<String, Expression>>,
|
||||
hasOptionalArguments: Boolean,
|
||||
flags: EnumSet<FunctionFlag>,
|
||||
function: ScriptFunction
|
||||
function: ScriptFunction,
|
||||
) {
|
||||
var functionDeclaration: FunctionDeclaration? = null
|
||||
val body = listOf(object : Executable {
|
||||
@ -255,8 +262,7 @@ object VimExtensionFacade {
|
||||
}
|
||||
|
||||
fun VimExtensionFacade.exportOperatorFunction(name: String, function: OperatorFunction) {
|
||||
exportScriptFunction(null, name, listOf("type"), emptyList(), false, noneOfEnum()) {
|
||||
editor, context, args ->
|
||||
exportScriptFunction(null, name, listOf("type"), emptyList(), false, noneOfEnum()) { editor, context, args ->
|
||||
|
||||
val type = args["type"]?.asString()
|
||||
val selectionType = when (type) {
|
||||
@ -268,8 +274,7 @@ fun VimExtensionFacade.exportOperatorFunction(name: String, function: OperatorFu
|
||||
|
||||
if (function.apply(editor, context, selectionType)) {
|
||||
ExecutionResult.Success
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ExecutionResult.Error
|
||||
}
|
||||
}
|
||||
|
@ -186,12 +186,24 @@ class ChangeGroup : VimChangeGroupBase() {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated(message = "Please use listenersNotifier", replaceWith = ReplaceWith("injector.listenersNotifier.modeChangeListeners.add", imports = ["import com.maddyhome.idea.vim.api.injector"]))
|
||||
@Deprecated(
|
||||
message = "Please use listenersNotifier",
|
||||
replaceWith = ReplaceWith(
|
||||
"injector.listenersNotifier.modeChangeListeners.add",
|
||||
imports = ["import com.maddyhome.idea.vim.api.injector"]
|
||||
)
|
||||
)
|
||||
fun addInsertListener(listener: VimInsertListener) {
|
||||
injector.listenersNotifier.modeChangeListeners.add(listener)
|
||||
}
|
||||
|
||||
@Deprecated(message = "Please use listenersNotifier", replaceWith = ReplaceWith("injector.listenersNotifier.modeChangeListeners.remove", imports = ["import com.maddyhome.idea.vim.api.injector"]))
|
||||
@Deprecated(
|
||||
message = "Please use listenersNotifier",
|
||||
replaceWith = ReplaceWith(
|
||||
"injector.listenersNotifier.modeChangeListeners.remove",
|
||||
imports = ["import com.maddyhome.idea.vim.api.injector"]
|
||||
)
|
||||
)
|
||||
fun removeInsertListener(listener: VimInsertListener) {
|
||||
injector.listenersNotifier.modeChangeListeners.remove(listener)
|
||||
}
|
||||
|
@ -156,7 +156,8 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
|
||||
|
||||
private static void repaintRelativeLineNumbers(final @NotNull Editor editor) {
|
||||
final EditorGutter gutter = editor.getGutter();
|
||||
final EditorGutterComponentEx gutterComponent = gutter instanceof EditorGutterComponentEx ? (EditorGutterComponentEx) gutter : null;
|
||||
final EditorGutterComponentEx gutterComponent =
|
||||
gutter instanceof EditorGutterComponentEx ? (EditorGutterComponentEx)gutter : null;
|
||||
if (gutterComponent != null) {
|
||||
gutterComponent.repaint();
|
||||
}
|
||||
@ -251,18 +252,18 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
|
||||
|
||||
@Override
|
||||
public void notifyIdeaJoin(@NotNull VimEditor editor) {
|
||||
notifyIdeaJoin(((IjVimEditor) editor).getEditor().getProject(), editor);
|
||||
notifyIdeaJoin(((IjVimEditor)editor).getEditor().getProject(), editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCaretsVisualAttributes(@NotNull VimEditor editor) {
|
||||
Editor ijEditor = ((IjVimEditor) editor).getEditor();
|
||||
Editor ijEditor = ((IjVimEditor)editor).getEditor();
|
||||
CaretVisualAttributesHelperKt.updateCaretsVisualAttributes(ijEditor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCaretsVisualPosition(@NotNull VimEditor editor) {
|
||||
Editor ijEditor = ((IjVimEditor) editor).getEditor();
|
||||
Editor ijEditor = ((IjVimEditor)editor).getEditor();
|
||||
CaretVisualAttributesHelperKt.updateCaretsVisualAttributes(ijEditor);
|
||||
}
|
||||
|
||||
@ -309,26 +310,21 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
|
||||
|
||||
@Override
|
||||
public @NotNull Collection<VimEditor> getEditorsRaw() {
|
||||
return getLocalEditors()
|
||||
.map(IjVimEditor::new)
|
||||
.collect(Collectors.toList());
|
||||
return getLocalEditors().map(IjVimEditor::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Collection<VimEditor> getEditors() {
|
||||
return getLocalEditors()
|
||||
.filter(UserDataManager::getVimInitialised)
|
||||
.map(IjVimEditor::new)
|
||||
return getLocalEditors().filter(UserDataManager::getVimInitialised).map(IjVimEditor::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Collection<VimEditor> getEditors(@NotNull VimDocument buffer) {
|
||||
final Document document = ((IjVimDocument)buffer).getDocument();
|
||||
return getLocalEditors()
|
||||
.filter(editor -> UserDataManager.getVimInitialised(editor) && editor.getDocument().equals(document))
|
||||
.map(IjVimEditor::new)
|
||||
.collect(Collectors.toList());
|
||||
return getLocalEditors().filter(
|
||||
editor -> UserDataManager.getVimInitialised(editor) && editor.getDocument().equals(document))
|
||||
.map(IjVimEditor::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Stream<Editor> getLocalEditors() {
|
||||
|
@ -28,8 +28,7 @@ import java.util.List;
|
||||
import static com.maddyhome.idea.vim.history.HistoryConstants.*;
|
||||
|
||||
@State(name = "VimHistorySettings", storages = {
|
||||
@Storage(value = "$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)
|
||||
})
|
||||
@Storage(value = "$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)})
|
||||
public class HistoryGroup extends VimHistoryBase implements PersistentStateComponent<Element> {
|
||||
|
||||
public void saveData(@NotNull Element element) {
|
||||
@ -108,7 +107,7 @@ public class HistoryGroup extends VimHistoryBase implements PersistentStateCompo
|
||||
return INPUT;
|
||||
}
|
||||
if (type instanceof VimHistory.Type.Custom) {
|
||||
return ((Type.Custom) type).getId();
|
||||
return ((Type.Custom)type).getId();
|
||||
}
|
||||
return "unreachable";
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesBase(sco
|
||||
*
|
||||
* As a convenience, this class also provides access to the IntelliJ specific global options, via inheritance.
|
||||
*/
|
||||
class EffectiveIjOptions(scope: OptionAccessScope.EFFECTIVE): GlobalIjOptions(scope) {
|
||||
class EffectiveIjOptions(scope: OptionAccessScope.EFFECTIVE) : GlobalIjOptions(scope) {
|
||||
// Vim options that are implemented purely by existing IntelliJ features and not used by vim-engine
|
||||
var breakindent: Boolean by optionProperty(IjOptions.breakindent)
|
||||
val colorcolumn: StringListOptionValue by optionProperty(IjOptions.colorcolumn)
|
||||
|
@ -122,6 +122,7 @@ object IjOptions {
|
||||
IjOptionConstants.ideavimsupportValues
|
||||
)
|
||||
)
|
||||
|
||||
@JvmField
|
||||
val ideawrite: StringOption = addOption(
|
||||
StringOption("ideawrite", GLOBAL, "ideawrite", "all", IjOptionConstants.ideaWriteValues)
|
||||
@ -131,17 +132,21 @@ object IjOptions {
|
||||
"lookupkeys",
|
||||
GLOBAL,
|
||||
"lookupkeys",
|
||||
"<Tab>,<Down>,<Up>,<Enter>,<Left>,<Right>,<C-Down>,<C-Up>,<PageUp>,<PageDown>,<C-J>,<C-Q>")
|
||||
"<Tab>,<Down>,<Up>,<Enter>,<Left>,<Right>,<C-Down>,<C-Up>,<PageUp>,<PageDown>,<C-J>,<C-Q>"
|
||||
)
|
||||
)
|
||||
val trackactionids: ToggleOption = addOption(ToggleOption("trackactionids", GLOBAL, "tai", false))
|
||||
val visualdelay: UnsignedNumberOption = addOption(UnsignedNumberOption("visualdelay", GLOBAL, "visualdelay", 100))
|
||||
|
||||
// Temporary feature flags during development, not really intended for external use
|
||||
val closenotebooks: ToggleOption = addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true, isHidden = true))
|
||||
val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isHidden = true))
|
||||
val closenotebooks: ToggleOption =
|
||||
addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true, isHidden = true))
|
||||
val commandOrMotionAnnotation: ToggleOption =
|
||||
addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isHidden = true))
|
||||
val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", false, isHidden = true))
|
||||
val unifyjumps: ToggleOption = addOption(ToggleOption("unifyjumps", GLOBAL, "unifyjumps", true, isHidden = true))
|
||||
val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isHidden = true))
|
||||
val vimscriptFunctionAnnotation: ToggleOption =
|
||||
addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isHidden = true))
|
||||
|
||||
// This needs to be Option<out VimDataType> so that it can work with derived option types, such as NumberOption, which
|
||||
// derives from Option<VimInt>
|
||||
|
@ -21,7 +21,7 @@ import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
|
||||
@Service
|
||||
class IjVimPsiService: VimPsiService {
|
||||
class IjVimPsiService : VimPsiService {
|
||||
override fun getCommentAtPos(editor: VimEditor, pos: Int): Pair<TextRange, Pair<String, String>?>? {
|
||||
val psiFile = PsiHelper.getFile(editor.ij) ?: return null
|
||||
val psiElement = psiFile.findElementAt(pos) ?: return null
|
||||
|
@ -42,14 +42,14 @@ internal class IjVimStorageService : VimStorageServiceBase() {
|
||||
private val ijKeys = mutableMapOf<String, Key<out Any?>>()
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private val <T> com.maddyhome.idea.vim.api.Key<T>.ij : Key<T>
|
||||
private val <T> com.maddyhome.idea.vim.api.Key<T>.ij: Key<T>
|
||||
get(): Key<T> {
|
||||
val storedIjKey = ijKeys[this.name]
|
||||
if (storedIjKey != null) {
|
||||
return storedIjKey as Key<T>
|
||||
val storedIjKey = ijKeys[this.name]
|
||||
if (storedIjKey != null) {
|
||||
return storedIjKey as Key<T>
|
||||
}
|
||||
val newKey = Key<T>(this.name)
|
||||
ijKeys[this.name] = newKey
|
||||
return newKey
|
||||
}
|
||||
val newKey = Key<T>(this.name)
|
||||
ijKeys[this.name] = newKey
|
||||
return newKey
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ import static java.util.stream.Collectors.toList;
|
||||
* @author vlan
|
||||
*/
|
||||
@State(name = "VimKeySettings", storages = {@Storage(value = "$APP_CONFIG$/vim_settings.xml")})
|
||||
public class KeyGroup extends VimKeyGroupBase implements PersistentStateComponent<Element>{
|
||||
public class KeyGroup extends VimKeyGroupBase implements PersistentStateComponent<Element> {
|
||||
public static final @NonNls String SHORTCUT_CONFLICTS_ELEMENT = "shortcut-conflicts";
|
||||
private static final @NonNls String SHORTCUT_CONFLICT_ELEMENT = "shortcut-conflict";
|
||||
private static final @NonNls String OWNER_ATTRIBUTE = "owner";
|
||||
@ -303,8 +303,8 @@ public class KeyGroup extends VimKeyGroupBase implements PersistentStateComponen
|
||||
|
||||
@Override
|
||||
public @NotNull List<NativeAction> getActions(@NotNull VimEditor editor, @NotNull KeyStroke keyStroke) {
|
||||
return getActions(((IjVimEditor)editor).getEditor().getComponent(), keyStroke).stream()
|
||||
.map(IjNativeAction::new).collect(toList());
|
||||
return getActions(((IjVimEditor)editor).getEditor().getComponent(), keyStroke).stream().map(IjNativeAction::new)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
private static @NotNull List<AnAction> getLocalActions(@NotNull Component component, @NotNull KeyStroke keyStroke) {
|
||||
@ -355,21 +355,26 @@ public class KeyGroup extends VimKeyGroupBase implements PersistentStateComponen
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showKeyMappings(@NotNull Set<? extends MappingMode> modes, @NotNull List<? extends KeyStroke> prefix, @NotNull VimEditor editor) {
|
||||
public boolean showKeyMappings(@NotNull Set<? extends MappingMode> modes,
|
||||
@NotNull List<? extends KeyStroke> prefix,
|
||||
@NotNull VimEditor editor) {
|
||||
List<Pair<Set<MappingMode>, MappingInfo>> rows = getKeyMappingRows(modes, prefix);
|
||||
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (Pair<Set<MappingMode>, MappingInfo> row : rows) {
|
||||
MappingInfo mappingInfo = row.getSecond();
|
||||
builder.append(StringsKt.padEnd(getModesStringCode(row.getFirst()), 3, ' '));
|
||||
builder.append(StringsKt.padEnd(VimInjectorKt.getInjector().getParser().toKeyNotation(mappingInfo.getFromKeys()) + " ", 12, ' '));
|
||||
builder.append(
|
||||
StringsKt.padEnd(VimInjectorKt.getInjector().getParser().toKeyNotation(mappingInfo.getFromKeys()) + " ", 12,
|
||||
' '));
|
||||
builder.append(mappingInfo.isRecursive() ? " " : "*"); // Or `&` if script-local mappings being recursive
|
||||
builder.append(" "); // Should be `@` if it's a buffer-local mapping
|
||||
builder.append(mappingInfo.getPresentableString());
|
||||
builder.append("\n");
|
||||
}
|
||||
|
||||
VimOutputPanel outputPanel = injector.getOutputPanel().getOrCreate(editor, injector.getExecutionContextManager().getEditorExecutionContext(editor));
|
||||
VimOutputPanel outputPanel = injector.getOutputPanel()
|
||||
.getOrCreate(editor, injector.getExecutionContextManager().getEditorExecutionContext(editor));
|
||||
outputPanel.addText(builder.toString(), true);
|
||||
outputPanel.show();
|
||||
return true;
|
||||
|
@ -318,11 +318,13 @@ internal class MotionGroup : VimMotionGroupBase() {
|
||||
vimEditor.exitVisualMode()
|
||||
KeyHandler.getInstance().reset(vimEditor)
|
||||
}
|
||||
|
||||
is Mode.CMD_LINE -> {
|
||||
val commandLine = injector.commandLine.getActiveCommandLine() ?: return
|
||||
commandLine.close(refocusOwningEditor = false, resetCaret = false)
|
||||
injector.outputPanel.getCurrentOutputPanel()?.close()
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
@ -215,6 +215,7 @@ internal class NotificationService(private val project: Project?) {
|
||||
is KeyMapIssue.AddShortcut -> {
|
||||
appendLine("- ${it.key} key is not assigned to the ${it.action} action.<br/>")
|
||||
}
|
||||
|
||||
is KeyMapIssue.RemoveShortcut -> {
|
||||
appendLine("- ${it.shortcut} key is incorrectly assigned to the ${it.action} action.<br/>")
|
||||
}
|
||||
@ -296,23 +297,25 @@ internal class NotificationService(private val project: Project?) {
|
||||
}
|
||||
} + "<small>See the ${ActionCenter.getToolwindowName()} tool window for previous IDs</small>"
|
||||
|
||||
notification = Notification(IDEAVIM_NOTIFICATION_ID, IDEAVIM_NOTIFICATION_TITLE, content, NotificationType.INFORMATION).also {
|
||||
it.whenExpired { notification = null }
|
||||
it.addAction(StopTracking())
|
||||
notification =
|
||||
Notification(IDEAVIM_NOTIFICATION_ID, IDEAVIM_NOTIFICATION_TITLE, content, NotificationType.INFORMATION).also {
|
||||
it.whenExpired { notification = null }
|
||||
it.addAction(StopTracking())
|
||||
|
||||
if (id != null || possibleIDs?.size == 1) {
|
||||
it.addAction(CopyActionId(id ?: possibleIDs?.get(0), project))
|
||||
if (id != null || possibleIDs?.size == 1) {
|
||||
it.addAction(CopyActionId(id ?: possibleIDs?.get(0), project))
|
||||
}
|
||||
|
||||
it.notify(project)
|
||||
}
|
||||
|
||||
it.notify(project)
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
ActionTracker.Util.logTrackedAction(id)
|
||||
}
|
||||
}
|
||||
|
||||
class CopyActionId(val id: String?, val project: Project?) : DumbAwareAction(MessageHelper.message("action.copy.action.id.text")) {
|
||||
class CopyActionId(val id: String?, val project: Project?) :
|
||||
DumbAwareAction(MessageHelper.message("action.copy.action.id.text")) {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
CopyPasteManager.getInstance().setContents(StringSelection(id ?: ""))
|
||||
if (id != null) {
|
||||
|
@ -66,7 +66,7 @@ import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.util.*
|
||||
|
||||
internal interface IjVimOptionGroup: VimOptionGroup {
|
||||
internal interface IjVimOptionGroup : VimOptionGroup {
|
||||
/**
|
||||
* Return an accessor for options that only have a global value
|
||||
*/
|
||||
@ -151,7 +151,7 @@ internal class OptionGroup : VimOptionGroupBase(), IjVimOptionGroup, InternalOpt
|
||||
override fun <T : VimDataType> setOptionValueInternal(
|
||||
option: Option<T>,
|
||||
scope: OptionAccessScope,
|
||||
value: OptionValue<T>
|
||||
value: OptionValue<T>,
|
||||
) {
|
||||
super.setOptionValueInternal(option, scope, value)
|
||||
}
|
||||
@ -391,7 +391,6 @@ private abstract class GlobalLocalOptionToGlobalLocalIdeaSettingMapper<T : VimDa
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Maps the `'bomb'` local-to-buffer Vim option to the file's current byte order mark
|
||||
*
|
||||
@ -425,7 +424,8 @@ private class BombOptionMapper : LocalOptionValueOverride<VimInt> {
|
||||
// Use IntelliJ's own actions to modify the BOM. This will change the BOM stored in the virtual file, update the
|
||||
// file contents and save it
|
||||
val actionId = if (hasBom) "RemoveBom" else "AddBom"
|
||||
val action = injector.actionExecutor.getAction(actionId) ?: throw ExException("Cannot find native action: $actionId")
|
||||
val action =
|
||||
injector.actionExecutor.getAction(actionId) ?: throw ExException("Cannot find native action: $actionId")
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(editor)
|
||||
injector.actionExecutor.executeAction(editor, action, context)
|
||||
return true
|
||||
@ -463,8 +463,8 @@ private class BreakIndentOptionMapper(
|
||||
*
|
||||
* TODO: This is a code style setting - how can we react to changes?
|
||||
*/
|
||||
private class ColorColumnOptionValueProvider(private val colorColumnOption: StringListOption)
|
||||
: LocalOptionToGlobalLocalExternalSettingMapper<VimString>(colorColumnOption) {
|
||||
private class ColorColumnOptionValueProvider(private val colorColumnOption: StringListOption) :
|
||||
LocalOptionToGlobalLocalExternalSettingMapper<VimString>(colorColumnOption) {
|
||||
|
||||
// The IntelliJ setting is in practice global, from the user's perspective
|
||||
override val canUserModifyExternalLocalValue: Boolean = false
|
||||
@ -510,8 +510,7 @@ private class ColorColumnOptionValueProvider(private val colorColumnOption: Stri
|
||||
// Given an empty string, hide the margin.
|
||||
if (value == VimString.EMPTY) {
|
||||
editor.ij.settings.isRightMarginShown = false
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
editor.ij.settings.isRightMarginShown = true
|
||||
|
||||
val softMargins = mutableListOf<Int>()
|
||||
@ -524,8 +523,7 @@ private class ColorColumnOptionValueProvider(private val colorColumnOption: Stri
|
||||
// We could perhaps add a property change listener from editor settings state?
|
||||
// (editor.ij as EditorImpl).state.addPropertyChangeListener(...)
|
||||
// (editor.ij.settings as SettingsImpl).getState().addPropertyChangeListener(...)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
it.toIntOrNull()?.let(softMargins::add)
|
||||
}
|
||||
}
|
||||
@ -559,8 +557,8 @@ private class ColorColumnOptionValueProvider(private val colorColumnOption: Stri
|
||||
*
|
||||
* Note that there isn't a global IntelliJ setting for this option.
|
||||
*/
|
||||
private class CursorLineOptionMapper(cursorLineOption: ToggleOption)
|
||||
: LocalOptionToGlobalLocalExternalSettingMapper<VimInt>(cursorLineOption) {
|
||||
private class CursorLineOptionMapper(cursorLineOption: ToggleOption) :
|
||||
LocalOptionToGlobalLocalExternalSettingMapper<VimInt>(cursorLineOption) {
|
||||
|
||||
// The IntelliJ setting is in practice global, from the user's perspective
|
||||
override val canUserModifyExternalLocalValue: Boolean = false
|
||||
@ -667,7 +665,12 @@ private class FileEncodingOptionMapper : LocalOptionValueOverride<VimString> {
|
||||
}
|
||||
}
|
||||
|
||||
private fun isSafeToReloadIn(virtualFile: VirtualFile, text: CharSequence, bytes: ByteArray, charset: Charset): Magic8 {
|
||||
private fun isSafeToReloadIn(
|
||||
virtualFile: VirtualFile,
|
||||
text: CharSequence,
|
||||
bytes: ByteArray,
|
||||
charset: Charset,
|
||||
): Magic8 {
|
||||
val bom = virtualFile.bom
|
||||
if (bom != null && !CharsetToolkit.canHaveBom(charset, bom)) return Magic8.NO_WAY
|
||||
|
||||
@ -680,11 +683,9 @@ private class FileEncodingOptionMapper : LocalOptionValueOverride<VimString> {
|
||||
|
||||
var bytesToSave = try {
|
||||
StringUtil.convertLineSeparators(loaded, separator).toByteArray(charset)
|
||||
}
|
||||
catch (e: UnsupportedOperationException) {
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
return Magic8.NO_WAY
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
} catch (e: NullPointerException) {
|
||||
return Magic8.NO_WAY
|
||||
}
|
||||
if (bom != null && !ArrayUtil.startsWith(bytesToSave, bom)) {
|
||||
@ -718,12 +719,14 @@ private class FileFormatOptionMapper : LocalOptionValueOverride<VimString> {
|
||||
// We should have a virtual file for most scenarios, e.g., scratch files, commit message dialog, etc.
|
||||
// The fallback window (TextComponentEditorImpl) does not have a virtual file
|
||||
val separator = editor.ij.virtualFile?.let { LoadTextUtil.detectLineSeparator(it, false) }
|
||||
val value = VimString(when (separator) {
|
||||
LineSeparator.LF.separatorString -> "unix"
|
||||
LineSeparator.CR.separatorString -> "mac"
|
||||
LineSeparator.CRLF.separatorString -> "dos"
|
||||
else -> if (injector.systemInfoService.isWindows) "dos" else "unix"
|
||||
})
|
||||
val value = VimString(
|
||||
when (separator) {
|
||||
LineSeparator.LF.separatorString -> "unix"
|
||||
LineSeparator.CR.separatorString -> "mac"
|
||||
LineSeparator.CRLF.separatorString -> "dos"
|
||||
else -> if (injector.systemInfoService.isWindows) "dos" else "unix"
|
||||
}
|
||||
)
|
||||
|
||||
// There is no difference between user/external/default - the file is always just one format
|
||||
return OptionValue.User(value)
|
||||
@ -762,8 +765,8 @@ private class FileFormatOptionMapper : LocalOptionValueOverride<VimString> {
|
||||
/**
|
||||
* Maps the `'list'` local-to-window Vim option to the IntelliJ global-local whitespace setting
|
||||
*/
|
||||
private class ListOptionMapper(listOption: ToggleOption, internalOptionValueAccessor: InternalOptionValueAccessor)
|
||||
: LocalOptionToGlobalLocalIdeaSettingMapper<VimInt>(listOption, internalOptionValueAccessor) {
|
||||
private class ListOptionMapper(listOption: ToggleOption, internalOptionValueAccessor: InternalOptionValueAccessor) :
|
||||
LocalOptionToGlobalLocalIdeaSettingMapper<VimInt>(listOption, internalOptionValueAccessor) {
|
||||
|
||||
override val ideaPropertyName: String = EditorSettingsExternalizable.PropNames.PROP_IS_WHITESPACES_SHOWN
|
||||
|
||||
@ -787,8 +790,8 @@ private class ListOptionMapper(listOption: ToggleOption, internalOptionValueAcce
|
||||
*
|
||||
* Note that this must work with `'relativenumber'` to correctly handle the hybrid modes.
|
||||
*/
|
||||
private class NumberOptionMapper(numberOption: ToggleOption, internalOptionValueAccessor: InternalOptionValueAccessor)
|
||||
: LocalOptionToGlobalLocalIdeaSettingMapper<VimInt>(numberOption, internalOptionValueAccessor) {
|
||||
private class NumberOptionMapper(numberOption: ToggleOption, internalOptionValueAccessor: InternalOptionValueAccessor) :
|
||||
LocalOptionToGlobalLocalIdeaSettingMapper<VimInt>(numberOption, internalOptionValueAccessor) {
|
||||
|
||||
// This is a global-local setting, and can be modified by the user via _View | Active Editor | Show Line Numbers_
|
||||
override val canUserModifyExternalLocalValue: Boolean = true
|
||||
@ -808,13 +811,11 @@ private class NumberOptionMapper(numberOption: ToggleOption, internalOptionValue
|
||||
if (isShowingRelativeLineNumbers(editor.ij.settings.lineNumerationType)) {
|
||||
editor.ij.settings.lineNumerationType = LineNumerationType.HYBRID
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
editor.ij.settings.isLineNumbersShown = true
|
||||
editor.ij.settings.lineNumerationType = LineNumerationType.ABSOLUTE
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Turn off 'number'. Hide lines if 'relativenumber' is not set, else switch to relative
|
||||
if (editor.ij.settings.isLineNumbersShown) {
|
||||
if (isShowingRelativeLineNumbers(editor.ij.settings.lineNumerationType)) {
|
||||
@ -828,7 +829,8 @@ private class NumberOptionMapper(numberOption: ToggleOption, internalOptionValue
|
||||
|
||||
override fun onGlobalIdeaValueChanged(propertyName: String) {
|
||||
if (propertyName == EditorSettingsExternalizable.PropNames.PROP_ARE_LINE_NUMBERS_SHOWN
|
||||
|| propertyName == EditorSettingsExternalizable.PropNames.PROP_LINE_NUMERATION) {
|
||||
|| propertyName == EditorSettingsExternalizable.PropNames.PROP_LINE_NUMERATION
|
||||
) {
|
||||
doOnGlobalIdeaValueChanged()
|
||||
}
|
||||
}
|
||||
@ -863,13 +865,11 @@ private class RelativeNumberOptionMapper(
|
||||
if (isShowingAbsoluteLineNumbers(editor.ij.settings.lineNumerationType)) {
|
||||
editor.ij.settings.lineNumerationType = LineNumerationType.HYBRID
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
editor.ij.settings.isLineNumbersShown = true
|
||||
editor.ij.settings.lineNumerationType = LineNumerationType.RELATIVE
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Turn off 'relativenumber'. Hide lines if 'number' is not set, else switch to relative
|
||||
if (editor.ij.settings.isLineNumbersShown) {
|
||||
if (isShowingAbsoluteLineNumbers(editor.ij.settings.lineNumerationType)) {
|
||||
@ -883,7 +883,8 @@ private class RelativeNumberOptionMapper(
|
||||
|
||||
override fun onGlobalIdeaValueChanged(propertyName: String) {
|
||||
if (propertyName == EditorSettingsExternalizable.PropNames.PROP_ARE_LINE_NUMBERS_SHOWN
|
||||
|| propertyName == EditorSettingsExternalizable.PropNames.PROP_LINE_NUMERATION) {
|
||||
|| propertyName == EditorSettingsExternalizable.PropNames.PROP_LINE_NUMERATION
|
||||
) {
|
||||
doOnGlobalIdeaValueChanged()
|
||||
}
|
||||
}
|
||||
@ -914,8 +915,8 @@ private fun isShowingRelativeLineNumbers(lineNumerationType: LineNumerationType)
|
||||
* We can also clear the overridden IDE setting value by setting it to `-1`. So when the user resets the Vim option to
|
||||
* defaults, it will again map to the global IDE value. It's a shame not all IDE settings do this.
|
||||
*/
|
||||
private class ScrollJumpOptionMapper(option: NumberOption, internalOptionValueAccessor: InternalOptionValueAccessor)
|
||||
: GlobalOptionToGlobalLocalIdeaSettingMapper<VimInt>(option, internalOptionValueAccessor) {
|
||||
private class ScrollJumpOptionMapper(option: NumberOption, internalOptionValueAccessor: InternalOptionValueAccessor) :
|
||||
GlobalOptionToGlobalLocalIdeaSettingMapper<VimInt>(option, internalOptionValueAccessor) {
|
||||
|
||||
override val ideaPropertyName: String = EditorSettingsExternalizable.PropNames.PROP_VERTICAL_SCROLL_JUMP
|
||||
|
||||
@ -949,8 +950,8 @@ private class ScrollJumpOptionMapper(option: NumberOption, internalOptionValueAc
|
||||
* We can also clear the overridden IDE setting value by setting it to `-1`. So when the user resets the Vim option to
|
||||
* defaults, it will again map to the global IDE value. It's a shame not all IDE settings do this.
|
||||
*/
|
||||
private class SideScrollOptionMapper(option: NumberOption, internalOptionValueAccessor: InternalOptionValueAccessor)
|
||||
: GlobalOptionToGlobalLocalIdeaSettingMapper<VimInt>(option, internalOptionValueAccessor) {
|
||||
private class SideScrollOptionMapper(option: NumberOption, internalOptionValueAccessor: InternalOptionValueAccessor) :
|
||||
GlobalOptionToGlobalLocalIdeaSettingMapper<VimInt>(option, internalOptionValueAccessor) {
|
||||
|
||||
override val ideaPropertyName: String = EditorSettingsExternalizable.PropNames.PROP_HORIZONTAL_SCROLL_JUMP
|
||||
|
||||
@ -1140,8 +1141,8 @@ private abstract class OneWayGlobalLocalOptionToGlobalLocalIdeaSettingMapper<T :
|
||||
* (window) overrides. The [LocalOptionToGlobalLocalExternalSettingMapper] base class will handle this by calling
|
||||
* [setLocalExternalValue] for all open editors for the changed buffer.
|
||||
*/
|
||||
private class TextWidthOptionMapper(textWidthOption: NumberOption)
|
||||
: LocalOptionToGlobalLocalExternalSettingMapper<VimInt>(textWidthOption) {
|
||||
private class TextWidthOptionMapper(textWidthOption: NumberOption) :
|
||||
LocalOptionToGlobalLocalExternalSettingMapper<VimInt>(textWidthOption) {
|
||||
|
||||
// The IntelliJ setting is in practice global, from the user's perspective
|
||||
override val canUserModifyExternalLocalValue: Boolean = false
|
||||
@ -1168,8 +1169,7 @@ private class TextWidthOptionMapper(textWidthOption: NumberOption)
|
||||
val project = ijEditor.project ?: ProjectManager.getInstance().defaultProject
|
||||
return if (ijEditor.settings.isWrapWhenTypingReachesRightMargin(project)) {
|
||||
ijEditor.settings.getRightMargin(ijEditor.project).asVimInt()
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
VimInt.ZERO
|
||||
}
|
||||
}
|
||||
@ -1215,8 +1215,8 @@ private class TextWidthOptionMapper(textWidthOption: NumberOption)
|
||||
/**
|
||||
* Maps the `'wrap'` Vim option to the IntelliJ soft wrap settings
|
||||
*/
|
||||
private class WrapOptionMapper(wrapOption: ToggleOption, internalOptionValueAccessor: InternalOptionValueAccessor)
|
||||
: LocalOptionToGlobalLocalIdeaSettingMapper<VimInt>(wrapOption, internalOptionValueAccessor) {
|
||||
private class WrapOptionMapper(wrapOption: ToggleOption, internalOptionValueAccessor: InternalOptionValueAccessor) :
|
||||
LocalOptionToGlobalLocalIdeaSettingMapper<VimInt>(wrapOption, internalOptionValueAccessor) {
|
||||
|
||||
// This is a global-local setting, and can be modified by the user via _View | Active Editor | Soft-Wrap_
|
||||
override val canUserModifyExternalLocalValue: Boolean = true
|
||||
@ -1245,7 +1245,9 @@ private class WrapOptionMapper(wrapOption: ToggleOption, internalOptionValueAcce
|
||||
fun editorKindToSoftWrapAppliancesPlace(kind: EditorKind) = when (kind) {
|
||||
EditorKind.UNTYPED,
|
||||
EditorKind.DIFF,
|
||||
EditorKind.MAIN_EDITOR -> SoftWrapAppliancePlaces.MAIN_EDITOR
|
||||
EditorKind.MAIN_EDITOR,
|
||||
-> SoftWrapAppliancePlaces.MAIN_EDITOR
|
||||
|
||||
EditorKind.CONSOLE -> SoftWrapAppliancePlaces.CONSOLE
|
||||
// Treat PREVIEW as a kind of MAIN_EDITOR instead of SWAP.PREVIEW. There are fewer noticeable differences
|
||||
EditorKind.PREVIEW -> SoftWrapAppliancePlaces.MAIN_EDITOR
|
||||
@ -1261,7 +1263,9 @@ private class WrapOptionMapper(wrapOption: ToggleOption, internalOptionValueAcce
|
||||
val softWrapAppliancePlace = when (editor.ij.editorKind) {
|
||||
EditorKind.UNTYPED,
|
||||
EditorKind.DIFF,
|
||||
EditorKind.MAIN_EDITOR -> SoftWrapAppliancePlaces.MAIN_EDITOR
|
||||
EditorKind.MAIN_EDITOR,
|
||||
-> SoftWrapAppliancePlaces.MAIN_EDITOR
|
||||
|
||||
EditorKind.CONSOLE -> SoftWrapAppliancePlaces.CONSOLE
|
||||
EditorKind.PREVIEW -> SoftWrapAppliancePlaces.PREVIEW
|
||||
}
|
||||
@ -1304,7 +1308,8 @@ private class WrapOptionMapper(wrapOption: ToggleOption, internalOptionValueAcce
|
||||
|
||||
override fun onGlobalIdeaValueChanged(propertyName: String) {
|
||||
if (propertyName == EditorSettingsExternalizable.PropNames.PROP_USE_SOFT_WRAPS
|
||||
|| propertyName == EditorSettingsExternalizable.PropNames.PROP_SOFT_WRAP_FILE_MASKS) {
|
||||
|| propertyName == EditorSettingsExternalizable.PropNames.PROP_SOFT_WRAP_FILE_MASKS
|
||||
) {
|
||||
doOnGlobalIdeaValueChanged()
|
||||
}
|
||||
}
|
||||
@ -1331,8 +1336,10 @@ class IjOptionConstants {
|
||||
const val ideawrite_file: String = "file"
|
||||
|
||||
val ideaStatusIconValues: Set<String> = setOf(ideastatusicon_enabled, ideastatusicon_gray, ideastatusicon_disabled)
|
||||
val ideaRefactorModeValues: Set<String> = setOf(idearefactormode_keep, idearefactormode_select, idearefactormode_visual)
|
||||
val ideaRefactorModeValues: Set<String> =
|
||||
setOf(idearefactormode_keep, idearefactormode_select, idearefactormode_visual)
|
||||
val ideaWriteValues: Set<String> = setOf(ideawrite_all, ideawrite_file)
|
||||
val ideavimsupportValues: Set<String> = setOf(ideavimsupport_dialog, ideavimsupport_singleline, ideavimsupport_dialoglegacy)
|
||||
val ideavimsupportValues: Set<String> =
|
||||
setOf(ideavimsupport_dialog, ideavimsupport_singleline, ideavimsupport_dialoglegacy)
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class ProcessGroup : VimProcessGroupBase() {
|
||||
editor: VimEditor,
|
||||
command: String,
|
||||
input: CharSequence?,
|
||||
currentDirectoryPath: String?
|
||||
currentDirectoryPath: String?,
|
||||
): String? {
|
||||
// This is a much simplified version of how Vim does this. We're using stdin/stdout directly, while Vim will
|
||||
// redirect to temp files ('shellredir' and 'shelltemp') or use pipes. We don't support 'shellquote', because we're
|
||||
|
@ -33,8 +33,7 @@ import static com.maddyhome.idea.vim.api.VimInjectorKt.injector;
|
||||
* This group works with command associated with copying and pasting text
|
||||
*/
|
||||
@State(name = "VimRegisterSettings", storages = {
|
||||
@Storage(value = "$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)
|
||||
})
|
||||
@Storage(value = "$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)})
|
||||
public class RegisterGroup extends VimRegisterGroupBase implements PersistentStateComponent<Element> {
|
||||
|
||||
static {
|
||||
@ -146,9 +145,8 @@ public class RegisterGroup extends VimRegisterGroupBase implements PersistentSta
|
||||
final int modifiers = Integer.parseInt(keyElement.getAttributeValue("mods"));
|
||||
final char c = (char)Integer.parseInt(keyElement.getAttributeValue("char"));
|
||||
//noinspection MagicConstant
|
||||
strokes.add(c == KeyEvent.CHAR_UNDEFINED ?
|
||||
KeyStroke.getKeyStroke(code, modifiers) :
|
||||
KeyStroke.getKeyStroke(c));
|
||||
strokes.add(
|
||||
c == KeyEvent.CHAR_UNDEFINED ? KeyStroke.getKeyStroke(code, modifiers) : KeyStroke.getKeyStroke(c));
|
||||
}
|
||||
register = new Register(key, type, strokes);
|
||||
}
|
||||
|
@ -28,11 +28,15 @@ import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.newapi.initInjector
|
||||
import org.jdom.Element
|
||||
|
||||
@State(name = "VimJumpsSettings", storages = [Storage(value = "\$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)])
|
||||
@State(
|
||||
name = "VimJumpsSettings",
|
||||
storages = [Storage(value = "\$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)]
|
||||
)
|
||||
internal class VimJumpServiceImpl : VimJumpServiceBase(), PersistentStateComponent<Element?> {
|
||||
companion object {
|
||||
private val logger = vimLogger<VimJumpServiceImpl>()
|
||||
}
|
||||
|
||||
override var lastJumpTimeStamp: Long = 0
|
||||
|
||||
override fun includeCurrentCommandAsNavigation(editor: VimEditor) {
|
||||
@ -93,7 +97,7 @@ internal class JumpsListener(val project: Project) : RecentPlacesListener {
|
||||
override fun recentPlaceAdded(changePlace: PlaceInfo, isChanged: Boolean) {
|
||||
initInjector()
|
||||
if (!injector.globalIjOptions().unifyjumps) return
|
||||
|
||||
|
||||
val jumpService = injector.jumpService
|
||||
if (!isChanged) {
|
||||
if (changePlace.timeStamp < jumpService.lastJumpTimeStamp) return // this listener is notified asynchronously, and
|
||||
@ -105,7 +109,7 @@ internal class JumpsListener(val project: Project) : RecentPlacesListener {
|
||||
|
||||
override fun recentPlaceRemoved(changePlace: PlaceInfo, isChanged: Boolean) {
|
||||
if (!injector.globalIjOptions().unifyjumps) return
|
||||
|
||||
|
||||
val jumpService = injector.jumpService
|
||||
if (!isChanged) {
|
||||
if (changePlace.timeStamp < jumpService.lastJumpTimeStamp) return // this listener is notified asynchronously, and
|
||||
|
@ -45,7 +45,10 @@ import java.util.*
|
||||
// todo sync vim jumps with ide jumps
|
||||
|
||||
// todo exception after moving to global mark after deleting it via IDE (impossible to receive markChar)
|
||||
@State(name = "VimMarksSettings", storages = [Storage(value = "\$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)])
|
||||
@State(
|
||||
name = "VimMarksSettings",
|
||||
storages = [Storage(value = "\$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)]
|
||||
)
|
||||
internal class VimMarkServiceImpl : VimMarkServiceBase(), PersistentStateComponent<Element?> {
|
||||
private fun createOrGetSystemMark(ch: Char, line: Int, col: Int, editor: VimEditor): Mark? {
|
||||
val ijEditor = (editor as IjVimEditor).editor
|
||||
@ -71,7 +74,8 @@ internal class VimMarkServiceImpl : VimMarkServiceBase(), PersistentStateCompone
|
||||
}
|
||||
element.addContent(globalMarksElement)
|
||||
val localMarksElement = Element("localmarks")
|
||||
var files: List<LocalMarks<Char, Mark>> = filepathToLocalMarks.values.sortedWith(Comparator.comparing(LocalMarks<Char, Mark>::myTimestamp))
|
||||
var files: List<LocalMarks<Char, Mark>> =
|
||||
filepathToLocalMarks.values.sortedWith(Comparator.comparing(LocalMarks<Char, Mark>::myTimestamp))
|
||||
if (files.size > SAVE_MARK_COUNT) {
|
||||
files = files.subList(files.size - SAVE_MARK_COUNT, files.size)
|
||||
}
|
||||
@ -85,7 +89,12 @@ internal class VimMarkServiceImpl : VimMarkServiceBase(), PersistentStateCompone
|
||||
fileMarkElem.setAttribute("name", file)
|
||||
fileMarkElem.setAttribute("timestamp", java.lang.Long.toString(marks.myTimestamp.time))
|
||||
for (mark in marks.values) {
|
||||
if (!Character.isUpperCase(mark.key) && injector.markService.isValidMark(mark.key, VimMarkService.Operation.SAVE, true)) {
|
||||
if (!Character.isUpperCase(mark.key) && injector.markService.isValidMark(
|
||||
mark.key,
|
||||
VimMarkService.Operation.SAVE,
|
||||
true
|
||||
)
|
||||
) {
|
||||
val markElem = Element("mark")
|
||||
markElem.setAttribute("key", mark.key.toString())
|
||||
markElem.setAttribute("line", mark.line.toString())
|
||||
|
@ -56,7 +56,7 @@ public class WindowGroup extends WindowGroupBase {
|
||||
}
|
||||
|
||||
public void closeAll(@NotNull ExecutionContext context) {
|
||||
getFileEditorManager(((IjEditorExecutionContext) context).getContext()).closeAllFiles();
|
||||
getFileEditorManager(((IjEditorExecutionContext)context).getContext()).closeAllFiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,10 +105,13 @@ public class WindowGroup extends WindowGroupBase {
|
||||
@Override
|
||||
@RWLockLabel.Readonly
|
||||
@RequiresReadLock
|
||||
public void selectWindowInRow(@NotNull VimCaret caret, @NotNull ExecutionContext context, int relativePosition, boolean vertical) {
|
||||
final Caret ijCaret = ((IjVimCaret) caret).getCaret();
|
||||
public void selectWindowInRow(@NotNull VimCaret caret,
|
||||
@NotNull ExecutionContext context,
|
||||
int relativePosition,
|
||||
boolean vertical) {
|
||||
final Caret ijCaret = ((IjVimCaret)caret).getCaret();
|
||||
final FileEditorManagerEx fileEditorManager = getFileEditorManager(((DataContext)context.getContext()));
|
||||
final EditorWindow currentWindow = fileEditorManager.getCurrentWindow();
|
||||
final EditorWindow currentWindow = fileEditorManager.getCurrentWindow();
|
||||
if (currentWindow != null) {
|
||||
final EditorWindow[] windows = fileEditorManager.getWindows();
|
||||
final List<EditorWindow> row = findWindowsInRow(ijCaret, currentWindow, Arrays.asList(windows), vertical);
|
||||
@ -116,7 +119,8 @@ public class WindowGroup extends WindowGroupBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void selectWindow(@NotNull EditorWindow currentWindow, @NotNull List<EditorWindow> windows,
|
||||
private void selectWindow(@NotNull EditorWindow currentWindow,
|
||||
@NotNull List<EditorWindow> windows,
|
||||
int relativePosition) {
|
||||
final int pos = windows.indexOf(currentWindow);
|
||||
final int selected = pos + relativePosition;
|
||||
@ -126,7 +130,8 @@ public class WindowGroup extends WindowGroupBase {
|
||||
|
||||
private static @NotNull List<EditorWindow> findWindowsInRow(@NotNull Caret caret,
|
||||
@NotNull EditorWindow editorWindow,
|
||||
@NotNull List<EditorWindow> windows, final boolean vertical) {
|
||||
@NotNull List<EditorWindow> windows,
|
||||
final boolean vertical) {
|
||||
final Point anchorPoint = getCaretPoint(caret);
|
||||
if (anchorPoint != null) {
|
||||
final List<EditorWindow> result = new ArrayList<>();
|
||||
|
@ -181,7 +181,8 @@ internal class PutGroup : VimPutBase() {
|
||||
val firstItemBefore = allContentsBefore.firstOrNull()
|
||||
logger.debug { "Copied text: ${text.copiedText}" }
|
||||
val (textContent, transferableData) = text.copiedText as IjVimCopiedText
|
||||
val origContent: TextBlockTransferable = injector.clipboardManager.setClipboardText(textContent, textContent, transferableData) as TextBlockTransferable
|
||||
val origContent: TextBlockTransferable =
|
||||
injector.clipboardManager.setClipboardText(textContent, textContent, transferableData) as TextBlockTransferable
|
||||
val allContentsAfter = CopyPasteManager.getInstance().allContents
|
||||
val sizeAfterInsert = allContentsAfter.size
|
||||
try {
|
||||
|
@ -159,18 +159,22 @@ internal object IdeaSelectionControl {
|
||||
if (logReason) logger.debug("Enter select mode. Reason: one line mode")
|
||||
Mode.SELECT(VimPlugin.getVisualMotion().detectSelectionType(editor.vim))
|
||||
}
|
||||
|
||||
selectionSource == VimListenerManager.SelectionSource.MOUSE && OptionConstants.selectmode_mouse in selectmode -> {
|
||||
if (logReason) logger.debug("Enter select mode. Selection source is mouse and selectMode option has mouse")
|
||||
Mode.SELECT(VimPlugin.getVisualMotion().detectSelectionType(editor.vim))
|
||||
}
|
||||
|
||||
editor.isTemplateActive() && editor.vim.isIdeaRefactorModeSelect -> {
|
||||
if (logReason) logger.debug("Enter select mode. Template is active and selectMode has template")
|
||||
Mode.SELECT(VimPlugin.getVisualMotion().detectSelectionType(editor.vim))
|
||||
}
|
||||
|
||||
selectionSource == VimListenerManager.SelectionSource.OTHER && OptionConstants.selectmode_ideaselection in selectmode -> {
|
||||
if (logReason) logger.debug("Enter select mode. Selection source is OTHER and selectMode has refactoring")
|
||||
Mode.SELECT(VimPlugin.getVisualMotion().detectSelectionType(editor.vim))
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (logReason) logger.debug("Enter visual mode")
|
||||
Mode.VISUAL(VimPlugin.getVisualMotion().detectSelectionType(editor.vim))
|
||||
|
@ -31,7 +31,7 @@ import kotlinx.coroutines.launch
|
||||
|
||||
|
||||
// We use alarm with delay to avoid many actions in case many events are fired at the same time
|
||||
internal val correctorRequester = MutableSharedFlow<Unit>(replay=1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
|
||||
internal val correctorRequester = MutableSharedFlow<Unit>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
|
||||
|
||||
private val LOG = logger<CopilotKeymapCorrector>()
|
||||
|
||||
@ -106,8 +106,7 @@ private fun correctCopilotKeymap() {
|
||||
keymap.removeShortcut("copilot.disposeInlays", escapeShortcut)
|
||||
copilotHideActionMap[keymap.name] = Unit
|
||||
LOG.info("Remove copilot escape shortcut from keymap ${keymap.name}")
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
copilotHideActionMap.forEach { (name, _) ->
|
||||
val keymap = KeymapManagerEx.getInstanceEx().getKeymap(name) ?: return@forEach
|
||||
val currentShortcuts = keymap.getShortcuts("copilot.disposeInlays")
|
||||
|
@ -18,7 +18,12 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
* Base class for Vim commands handled by existing IDE actions.
|
||||
*/
|
||||
internal abstract class IdeActionHandler(private val actionName: String) : VimActionHandler.SingleExecution() {
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
||||
override fun execute(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
cmd: Command,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Boolean {
|
||||
injector.actionExecutor.executeAction(editor, name = actionName, context = context)
|
||||
injector.scroll.scrollCaretIntoView(editor)
|
||||
return true
|
||||
|
@ -31,7 +31,7 @@ import kotlinx.coroutines.launch
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
// We use alarm with delay to avoid many notifications in case many events are fired at the same time
|
||||
internal val keyCheckRequests = MutableSharedFlow<Unit>(replay=1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
|
||||
internal val keyCheckRequests = MutableSharedFlow<Unit>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
|
||||
|
||||
/**
|
||||
* This checker verifies that the keymap has a correct configuration that is required for IdeaVim plugin
|
||||
@ -152,5 +152,5 @@ internal sealed interface KeyMapIssue {
|
||||
val action: String,
|
||||
val actionId: String,
|
||||
val shortcut: Shortcut,
|
||||
): KeyMapIssue
|
||||
) : KeyMapIssue
|
||||
}
|
@ -221,13 +221,13 @@ internal class VimEscHandler(nextHandler: EditorActionHandler) : VimKeyHandler(n
|
||||
|
||||
private val ideaVimSupportDialog
|
||||
get() = injector.globalIjOptions().ideavimsupport.contains(IjOptionConstants.ideavimsupport_dialog)
|
||||
|
||||
|
||||
override fun isHandlerEnabled(editor: Editor, dataContext: DataContext?): Boolean {
|
||||
return editor.isPrimaryEditor() ||
|
||||
EditorHelper.isFileEditor(editor) && vimStateNeedsToHandleEscape(editor) ||
|
||||
ideaVimSupportDialog && vimStateNeedsToHandleEscape(editor)
|
||||
}
|
||||
|
||||
|
||||
private fun vimStateNeedsToHandleEscape(editor: Editor): Boolean {
|
||||
return !editor.vim.mode.inNormalMode || KeyHandler.getInstance().keyHandlerState.mappingState.hasKeys
|
||||
}
|
||||
|
@ -111,9 +111,12 @@ private fun Editor.updateSecondaryCaretsVisualAttributes() {
|
||||
}
|
||||
}
|
||||
|
||||
private val HIDDEN = CaretVisualAttributes(null, CaretVisualAttributes.Weight.NORMAL, CaretVisualAttributes.Shape.BAR, 0F)
|
||||
private val BLOCK = CaretVisualAttributes(null, CaretVisualAttributes.Weight.NORMAL, CaretVisualAttributes.Shape.BLOCK, 1.0F)
|
||||
private val BAR = CaretVisualAttributes(null, CaretVisualAttributes.Weight.NORMAL, CaretVisualAttributes.Shape.BAR, 0.25F)
|
||||
private val HIDDEN =
|
||||
CaretVisualAttributes(null, CaretVisualAttributes.Weight.NORMAL, CaretVisualAttributes.Shape.BAR, 0F)
|
||||
private val BLOCK =
|
||||
CaretVisualAttributes(null, CaretVisualAttributes.Weight.NORMAL, CaretVisualAttributes.Shape.BLOCK, 1.0F)
|
||||
private val BAR =
|
||||
CaretVisualAttributes(null, CaretVisualAttributes.Weight.NORMAL, CaretVisualAttributes.Shape.BAR, 0.25F)
|
||||
|
||||
private object AttributesCache {
|
||||
private var lastGuicursorValue = ""
|
||||
|
@ -79,7 +79,8 @@ public class EditorHelper {
|
||||
public static int getVisualLineAtMiddleOfScreen(final @NotNull Editor editor) {
|
||||
// The editor will return line numbers of virtual space if the text doesn't reach the end of the visible area
|
||||
// (either because it's too short, or it's been scrolled up)
|
||||
final int lastLineBaseline = editor.logicalPositionToXY(new LogicalPosition(new IjVimEditor(editor).lineCount(), 0)).y;
|
||||
final int lastLineBaseline =
|
||||
editor.logicalPositionToXY(new LogicalPosition(new IjVimEditor(editor).lineCount(), 0)).y;
|
||||
final Rectangle visibleArea = getVisibleArea(editor);
|
||||
final int height = min(lastLineBaseline - visibleArea.y, visibleArea.height);
|
||||
return editor.yToVisualLine(visibleArea.y + (height / 2));
|
||||
@ -91,8 +92,7 @@ public class EditorHelper {
|
||||
// Adjust available height if the ex entry text field is visible
|
||||
final Rectangle visibleArea = getVisibleArea(editor);
|
||||
final int height = visibleArea.height - getExEntryHeight() - getHorizontalScrollbarHeight(editor);
|
||||
return getFullVisualLine(editor, visibleArea.y + height, visibleArea.y,
|
||||
visibleArea.y + height);
|
||||
return getFullVisualLine(editor, visibleArea.y + height, visibleArea.y, visibleArea.y + height);
|
||||
}
|
||||
|
||||
public static int getVisualLineAtBottomOfScreen(final @NotNull Editor editor) {
|
||||
@ -288,7 +288,8 @@ public class EditorHelper {
|
||||
// virtual space at the bottom of the screen
|
||||
final @NotNull VimEditor editor1 = new IjVimEditor(editor);
|
||||
final int lastVisualLine = EngineEditorHelperKt.getVisualLineCount(editor1) - 1;
|
||||
final int yBottomLineOffset = max(getOffsetToScrollVisualLineToBottomOfScreen(editor, lastVisualLine), visibleArea.y);
|
||||
final int yBottomLineOffset =
|
||||
max(getOffsetToScrollVisualLineToBottomOfScreen(editor, lastVisualLine), visibleArea.y);
|
||||
scrollVertically(editor, min(yVisualLine - caretScreenOffset - inlayOffset, yBottomLineOffset));
|
||||
}
|
||||
|
||||
@ -331,7 +332,9 @@ public class EditorHelper {
|
||||
* @param editor The editor to scroll
|
||||
* @param visualLine The visual line to place in the middle of the current window
|
||||
*/
|
||||
public static void scrollVisualLineToMiddleOfScreen(@NotNull Editor editor, int visualLine, boolean allowVirtualSpace) {
|
||||
public static void scrollVisualLineToMiddleOfScreen(@NotNull Editor editor,
|
||||
int visualLine,
|
||||
boolean allowVirtualSpace) {
|
||||
final int y = editor.visualLineToY(EngineEditorHelperKt.normalizeVisualLine(new IjVimEditor(editor), visualLine));
|
||||
final Rectangle visibleArea = getVisibleArea(editor);
|
||||
final int screenHeight = visibleArea.height;
|
||||
@ -423,7 +426,8 @@ public class EditorHelper {
|
||||
}
|
||||
}
|
||||
|
||||
final int columnLeftX = (int) Math.round(editor.visualPositionToPoint2D(new VisualPosition(visualLine, targetVisualColumn)).getX());
|
||||
final int columnLeftX =
|
||||
(int)Math.round(editor.visualPositionToPoint2D(new VisualPosition(visualLine, targetVisualColumn)).getX());
|
||||
scrollHorizontally(editor, columnLeftX);
|
||||
}
|
||||
|
||||
@ -435,8 +439,8 @@ public class EditorHelper {
|
||||
// of columns. It also works with inline inlays and folds. It is slightly inaccurate for proportional fonts, but is
|
||||
// still a good solution. Besides, what kind of monster uses Vim with proportional fonts?
|
||||
final float standardColumnWidth = EditorHelper.getPlainSpaceWidthFloat(editor);
|
||||
final int screenMidColumn = (int) (screenWidth / standardColumnWidth / 2);
|
||||
final int x = max(0, (int) Math.round(point.getX() - (screenMidColumn * standardColumnWidth)));
|
||||
final int screenMidColumn = (int)(screenWidth / standardColumnWidth / 2);
|
||||
final int x = max(0, (int)Math.round(point.getX() - (screenMidColumn * standardColumnWidth)));
|
||||
scrollHorizontally(editor, x);
|
||||
}
|
||||
|
||||
@ -461,7 +465,8 @@ public class EditorHelper {
|
||||
}
|
||||
|
||||
// Scroll to the left edge of the target column, minus a screenwidth, and adjusted for inlays
|
||||
final int targetColumnRightX = (int) Math.round(editor.visualPositionToPoint2D(new VisualPosition(visualLine, targetVisualColumn + 1)).getX());
|
||||
final int targetColumnRightX =
|
||||
(int)Math.round(editor.visualPositionToPoint2D(new VisualPosition(visualLine, targetVisualColumn + 1)).getX());
|
||||
final int screenWidth = getVisibleArea(editor).width;
|
||||
scrollHorizontally(editor, targetColumnRightX - screenWidth);
|
||||
}
|
||||
@ -469,8 +474,8 @@ public class EditorHelper {
|
||||
/**
|
||||
* Scroll page down, moving text up.
|
||||
*
|
||||
* @param editor The editor to scroll
|
||||
* @param pages How many pages to scroll
|
||||
* @param editor The editor to scroll
|
||||
* @param pages How many pages to scroll
|
||||
* @return A pair consisting of a flag to show if scrolling was completed, and a visual line to position the cart on
|
||||
*/
|
||||
public static Pair<Boolean, Integer> scrollFullPageDown(final @NotNull Editor editor, int pages) {
|
||||
@ -521,8 +526,8 @@ public class EditorHelper {
|
||||
/**
|
||||
* Scroll page up, moving text down.
|
||||
*
|
||||
* @param editor The editor to scroll
|
||||
* @param pages How many pages to scroll
|
||||
* @param editor The editor to scroll
|
||||
* @param pages How many pages to scroll
|
||||
* @return A pair consisting of a flag to show if scrolling was completed, and a visual line to position the cart on
|
||||
*/
|
||||
public static Pair<Boolean, Integer> scrollFullPageUp(final @NotNull Editor editor, int pages) {
|
||||
@ -596,7 +601,8 @@ public class EditorHelper {
|
||||
}
|
||||
|
||||
if (xActualLeft >= leftBound) {
|
||||
final VisualPosition nextVisualPosition = new VisualPosition(closestVisualPosition.line, closestVisualPosition.column + 1);
|
||||
final VisualPosition nextVisualPosition =
|
||||
new VisualPosition(closestVisualPosition.line, closestVisualPosition.column + 1);
|
||||
final long xActualRight = Math.round(editor.visualPositionToPoint2D(nextVisualPosition).getX()) - 1;
|
||||
if (xActualRight <= rightBound) {
|
||||
return closestVisualPosition.column;
|
||||
|
@ -56,7 +56,8 @@ internal class HandlerInjector {
|
||||
// only true in command mode.
|
||||
// Set by `org.jetbrains.plugins.notebooks.ui.editor.actions.command.mode.NotebookEditorModeListenerAdapter`
|
||||
// appears to be null in non Notebook editors
|
||||
val allow_plain_letter_shortcuts = editor.contentComponent.getClientProperty(ActionUtil.ALLOW_PlAIN_LETTER_SHORTCUTS)
|
||||
val allow_plain_letter_shortcuts =
|
||||
editor.contentComponent.getClientProperty(ActionUtil.ALLOW_PlAIN_LETTER_SHORTCUTS)
|
||||
inEditor && (allow_plain_letter_shortcuts != null && allow_plain_letter_shortcuts as Boolean)
|
||||
}
|
||||
} else {
|
||||
|
@ -138,7 +138,7 @@ internal class IjActionExecutor : VimActionExecutor {
|
||||
val action = getAction(name, context)
|
||||
return action != null && executeAction(editor, IjNativeAction(action), context)
|
||||
}
|
||||
|
||||
|
||||
private fun getAction(name: String, context: ExecutionContext): AnAction? {
|
||||
val actionManager = ActionManager.getInstance()
|
||||
val action = actionManager.getAction(name)
|
||||
|
@ -197,4 +197,5 @@ private fun skip(iterator: IntIterator, n: Int) {
|
||||
class CountPosition(val count: Int, val position: Int)
|
||||
|
||||
private val logger = logger<SearchLogger>()
|
||||
|
||||
private class SearchLogger
|
@ -48,8 +48,7 @@ internal fun updateIncsearchHighlights(
|
||||
): Int {
|
||||
val searchStartOffset = if (searchRange != null && searchRange.startLine < editor.document.lineCount) {
|
||||
editor.vim.getLineStartOffset(searchRange.startLine)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
caretOffset
|
||||
}
|
||||
val showHighlights = injector.options(editor.vim).hlsearch
|
||||
@ -218,8 +217,7 @@ private fun findClosestMatch(
|
||||
}
|
||||
val closestIndex = if (forwards) {
|
||||
sortedResults.indexOfFirst { it.startOffset > initialOffset }
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sortedResults.indexOfFirst { it.startOffset < initialOffset }
|
||||
}
|
||||
|
||||
@ -235,7 +233,12 @@ private fun findClosestMatch(
|
||||
return sortedResults[nextIndex % results.size].startOffset
|
||||
}
|
||||
|
||||
internal fun highlightSearchResults(editor: Editor, pattern: String, results: List<TextRange>, currentMatchOffset: Int) {
|
||||
internal fun highlightSearchResults(
|
||||
editor: Editor,
|
||||
pattern: String,
|
||||
results: List<TextRange>,
|
||||
currentMatchOffset: Int,
|
||||
) {
|
||||
var highlighters = editor.vimLastHighlighters
|
||||
if (highlighters == null) {
|
||||
highlighters = mutableListOf()
|
||||
|
@ -119,7 +119,7 @@ internal class UndoRedoHelper : VimTimestampBasedUndoService {
|
||||
private fun hasSelection(editor: VimEditor): Boolean {
|
||||
return editor.primaryCaret().ij.hasSelection()
|
||||
}
|
||||
|
||||
|
||||
override fun redo(editor: VimEditor, context: ExecutionContext): Boolean {
|
||||
val ijContext = context.context as DataContext
|
||||
val project = PlatformDataKeys.PROJECT.getData(ijContext) ?: return false
|
||||
|
@ -81,9 +81,11 @@ internal var Caret.vimLastColumn: Int
|
||||
_vimLastColumn = value
|
||||
_vimLastColumnPos = visualPosition
|
||||
}
|
||||
|
||||
internal fun Caret.resetVimLastColumn() {
|
||||
_vimLastColumnPos = null
|
||||
}
|
||||
|
||||
private var Caret._vimLastColumn: Int by userDataCaretToEditorOr { (this as Caret).inlayAwareVisualColumn }
|
||||
private var Caret._vimLastColumnPos: VisualPosition? by userDataCaretToEditor()
|
||||
|
||||
|
@ -72,7 +72,8 @@ internal object IdeaSpecifics {
|
||||
val isVimAction = (action as? AnActionWrapper)?.delegate is VimShortcutKeyAction
|
||||
if (!isVimAction && injector.globalIjOptions().trackactionids) {
|
||||
if (action !is NotificationService.ActionIdNotifier.CopyActionId && action !is NotificationService.ActionIdNotifier.StopTracking) {
|
||||
val id: String? = ActionManager.getInstance().getId(action) ?: (action.shortcutSet as? ProxyShortcutSet)?.actionId
|
||||
val id: String? =
|
||||
ActionManager.getInstance().getId(action) ?: (action.shortcutSet as? ProxyShortcutSet)?.actionId
|
||||
val candidates = if (id == null) {
|
||||
// Some actions are specific to the component they're registered for, and are copies of a global action,
|
||||
// reusing the action ID and shortcuts (e.g. `NextTab` is different for editor tabs and tool window tabs).
|
||||
@ -83,8 +84,7 @@ internal object IdeaSpecifics {
|
||||
// action. Note that we might return duplicate IDs because the keymap might have multiple shortcuts mapped
|
||||
// to the same action. The notifier will handle de-duplication and sorting as a presentation detail.
|
||||
action.shortcutSet.shortcuts.flatMap { KeymapManager.getInstance().activeKeymap.getActionIdList(it) }
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
|
||||
@ -125,7 +125,14 @@ internal object IdeaSpecifics {
|
||||
val caretShift = addedTextLength - (editor.caretModel.primaryCaret.offset - prevDocumentOffset)
|
||||
val leftArrow = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)
|
||||
|
||||
register.recordText(editor.document.getText(TextRange(prevDocumentOffset, prevDocumentOffset + addedTextLength)))
|
||||
register.recordText(
|
||||
editor.document.getText(
|
||||
TextRange(
|
||||
prevDocumentOffset,
|
||||
prevDocumentOffset + addedTextLength
|
||||
)
|
||||
)
|
||||
)
|
||||
repeat(caretShift.coerceAtLeast(0)) {
|
||||
register.recordKeyStroke(leftArrow)
|
||||
}
|
||||
|
@ -14,7 +14,10 @@ import com.maddyhome.idea.vim.common.ModeChangeListener
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
|
||||
@Deprecated(message = "Please use ModeChangeListener", replaceWith = ReplaceWith("ModeChangeListener", imports = ["import com.maddyhome.idea.vim.common.ModeChangeListener"]))
|
||||
@Deprecated(
|
||||
message = "Please use ModeChangeListener",
|
||||
replaceWith = ReplaceWith("ModeChangeListener", imports = ["import com.maddyhome.idea.vim.common.ModeChangeListener"])
|
||||
)
|
||||
interface VimInsertListener : ModeChangeListener {
|
||||
override fun modeChanged(editor: VimEditor, oldMode: Mode) {
|
||||
if (editor.mode == Mode.INSERT) {
|
||||
|
@ -197,7 +197,10 @@ internal object VimListenerManager {
|
||||
|
||||
val optionGroup = VimPlugin.getOptionGroup()
|
||||
optionGroup.addEffectiveOptionValueChangeListener(Options.number, EditorGroup.NumberChangeListener.INSTANCE)
|
||||
optionGroup.addEffectiveOptionValueChangeListener(IjOptions.relativenumber, EditorGroup.NumberChangeListener.INSTANCE)
|
||||
optionGroup.addEffectiveOptionValueChangeListener(
|
||||
IjOptions.relativenumber,
|
||||
EditorGroup.NumberChangeListener.INSTANCE
|
||||
)
|
||||
optionGroup.addEffectiveOptionValueChangeListener(Options.scrolloff, ScrollGroup.ScrollOptionsChangeListener)
|
||||
optionGroup.addEffectiveOptionValueChangeListener(Options.guicursor, GuicursorChangeListener)
|
||||
optionGroup.addGlobalOptionChangeListener(Options.showcmd, ShowCmdOptionChangeListener)
|
||||
@ -209,8 +212,10 @@ internal object VimListenerManager {
|
||||
macroWidgetOptionListener.onGlobalOptionChanged()
|
||||
|
||||
// Listen for and initialise new editors
|
||||
EventFacade.getInstance().addEditorFactoryListener(VimEditorFactoryListener, VimPlugin.getInstance().onOffDisposable)
|
||||
val busConnection = ApplicationManager.getApplication().messageBus.connect(VimPlugin.getInstance().onOffDisposable)
|
||||
EventFacade.getInstance()
|
||||
.addEditorFactoryListener(VimEditorFactoryListener, VimPlugin.getInstance().onOffDisposable)
|
||||
val busConnection =
|
||||
ApplicationManager.getApplication().messageBus.connect(VimPlugin.getInstance().onOffDisposable)
|
||||
busConnection.subscribe(FileOpenedSyncListener.TOPIC, VimEditorFactoryListener)
|
||||
}
|
||||
|
||||
@ -219,7 +224,10 @@ internal object VimListenerManager {
|
||||
|
||||
val optionGroup = VimPlugin.getOptionGroup()
|
||||
optionGroup.removeEffectiveOptionValueChangeListener(Options.number, EditorGroup.NumberChangeListener.INSTANCE)
|
||||
optionGroup.removeEffectiveOptionValueChangeListener(IjOptions.relativenumber, EditorGroup.NumberChangeListener.INSTANCE)
|
||||
optionGroup.removeEffectiveOptionValueChangeListener(
|
||||
IjOptions.relativenumber,
|
||||
EditorGroup.NumberChangeListener.INSTANCE
|
||||
)
|
||||
optionGroup.removeEffectiveOptionValueChangeListener(Options.scrolloff, ScrollGroup.ScrollOptionsChangeListener)
|
||||
optionGroup.removeGlobalOptionChangeListener(Options.showcmd, ShowCmdOptionChangeListener)
|
||||
optionGroup.removeGlobalOptionChangeListener(Options.showmode, modeWidgetOptionListener)
|
||||
@ -227,7 +235,7 @@ internal object VimListenerManager {
|
||||
optionGroup.removeEffectiveOptionValueChangeListener(Options.guicursor, GuicursorChangeListener)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
object EditorListeners {
|
||||
fun addAll() {
|
||||
val initialisedEditors = mutableSetOf<Editor>()
|
||||
@ -327,8 +335,7 @@ internal object VimListenerManager {
|
||||
val editorDisposable = editor.removeUserData(editorListenersDisposableKey)
|
||||
if (editorDisposable != null) {
|
||||
Disposer.dispose(editorDisposable)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// We definitely do not expect this to happen
|
||||
StrictMode.fail("Editor doesn't have disposable attached. $editor")
|
||||
}
|
||||
@ -447,8 +454,7 @@ internal object VimListenerManager {
|
||||
}
|
||||
EditorListeners.add(event.editor, openingEditor?.vim ?: injector.fallbackWindow, scenario)
|
||||
firstEditorInitialised = true
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// We've got a virtual file, so FileOpenedSyncListener will be called. Save data
|
||||
val project = openingEditor.project ?: return
|
||||
val virtualFile = openingEditor.virtualFile ?: return
|
||||
@ -461,15 +467,18 @@ internal object VimListenerManager {
|
||||
// If the user has enabled "Open declaration source in the same tab", the opening editor will be replaced as
|
||||
// long as it's not pinned, and it's not modified, and we're in the same split
|
||||
val canBeReused = UISettings.getInstance().reuseNotModifiedTabs &&
|
||||
(manager.getComposite(virtualFile) as? EditorComposite)?.let { composite ->
|
||||
!composite.isPinned && !composite.isModified
|
||||
} ?: false
|
||||
(manager.getComposite(virtualFile) as? EditorComposite)?.let { composite ->
|
||||
!composite.isPinned && !composite.isModified
|
||||
} ?: false
|
||||
|
||||
// Keep a track of the owner of the opening editor, so we can compare later, potentially after the opening
|
||||
// editor has been closed. This is nullable, but should always have a value
|
||||
val owningEditorWindow = getOwningEditorWindow(openingEditor)
|
||||
|
||||
event.editor.putUserData(openingEditorKey, OpeningEditor(openingEditor, owningEditorWindow, isPreview, canBeReused))
|
||||
event.editor.putUserData(
|
||||
openingEditorKey,
|
||||
OpeningEditor(openingEditor, owningEditorWindow, isPreview, canBeReused)
|
||||
)
|
||||
}
|
||||
|
||||
VimStandalonePluginUpdateChecker.getInstance().pluginUsed()
|
||||
@ -525,7 +534,7 @@ internal object VimListenerManager {
|
||||
// Sometimes the platform will not reuse a tab when you expect it to, e.g. when reuse tabs is enabled and
|
||||
// navigating to derived class. We'll confirm our heuristics by checking to see if the editor is still around
|
||||
val openingEditorIsClosed = editor.project?.let { p ->
|
||||
FileEditorManagerEx.getInstanceEx(p).allEditors.filterIsInstance(TextEditor::class.java).all { textEditor ->
|
||||
FileEditorManagerEx.getInstanceEx(p).allEditors.filterIsInstance<TextEditor>().all { textEditor ->
|
||||
textEditor.editor != openingEditor?.editor
|
||||
}
|
||||
} ?: false
|
||||
@ -547,7 +556,7 @@ internal object VimListenerManager {
|
||||
private fun getOwningEditorWindow(editor: Editor) = editor.project?.let { p ->
|
||||
FileEditorManagerEx.getInstanceEx(p).windows.find { editorWindow ->
|
||||
editorWindow.allComposites.any { composite ->
|
||||
composite.allEditors.filterIsInstance(TextEditor::class.java).any { it.editor == editor }
|
||||
composite.allEditors.filterIsInstance<TextEditor>().any { it.editor == editor }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -584,7 +593,8 @@ internal object VimListenerManager {
|
||||
|
||||
// TODO: It is very confusing that this logic is split between EditorSelectionHandler and EditorMouseHandler
|
||||
if (MouseEventsDataHolder.dragEventCount < MouseEventsDataHolder.allowedSkippedDragEvents
|
||||
&& lineStart != lineEnd && startOffset == caretOffset) {
|
||||
&& lineStart != lineEnd && startOffset == caretOffset
|
||||
) {
|
||||
if (lineEnd == endOffset - 1) {
|
||||
// When starting on an empty line and dragging vertically upwards onto
|
||||
// another line, the selection should include the entirety of the empty line
|
||||
|
@ -32,8 +32,7 @@ internal class IntellijMark(bookmark: LineBookmark, override val col: Int, proje
|
||||
}
|
||||
|
||||
private fun getMark(): LineBookmark? =
|
||||
getProject()?.let {
|
||||
project ->
|
||||
getProject()?.let { project ->
|
||||
BookmarksManager.getInstance(project)?.getBookmark(BookmarkType.get(key)) as? LineBookmark
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,11 @@ internal class IjClipboardManager : VimClipboardManager {
|
||||
|
||||
override fun setClipboardContent(editor: VimEditor, context: ExecutionContext, textData: VimCopiedText): Boolean {
|
||||
require(textData is IjVimCopiedText)
|
||||
return handleTextSetting(textData.text, textData.text, textData.transferableData) { content -> setContents(content) } != null
|
||||
return handleTextSetting(
|
||||
textData.text,
|
||||
textData.text,
|
||||
textData.transferableData
|
||||
) { content -> setContents(content) } != null
|
||||
}
|
||||
|
||||
// TODO prefer methods with ranges, because they collect and preprocess for us
|
||||
@ -129,7 +133,12 @@ internal class IjClipboardManager : VimClipboardManager {
|
||||
}
|
||||
}
|
||||
|
||||
override fun collectCopiedText(editor: VimEditor, context: ExecutionContext, range: TextRange, text: String): VimCopiedText {
|
||||
override fun collectCopiedText(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
range: TextRange,
|
||||
text: String,
|
||||
): VimCopiedText {
|
||||
val transferableData = getTransferableData(editor, range)
|
||||
val preprocessedText = preprocessText(editor, range, text, transferableData)
|
||||
return IjVimCopiedText(preprocessedText, transferableData)
|
||||
@ -140,7 +149,12 @@ internal class IjClipboardManager : VimClipboardManager {
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun handleTextSetting(text: String, rawText: String, transferableData: List<Any>, setContent: (TextBlockTransferable) -> Unit?): Transferable? {
|
||||
private fun handleTextSetting(
|
||||
text: String,
|
||||
rawText: String,
|
||||
transferableData: List<Any>,
|
||||
setContent: (TextBlockTransferable) -> Unit?,
|
||||
): Transferable? {
|
||||
val mutableTransferableData = (transferableData as List<TextBlockTransferableData>).toMutableList()
|
||||
try {
|
||||
val s = TextBlockTransferable.convertLineSeparators(text, "\n", mutableTransferableData)
|
||||
@ -182,7 +196,12 @@ internal class IjClipboardManager : VimClipboardManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
transferableData.add(CaretStateTransferableData(intArrayOf(0), intArrayOf(textRange.endOffset - textRange.startOffset)))
|
||||
transferableData.add(
|
||||
CaretStateTransferableData(
|
||||
intArrayOf(0),
|
||||
intArrayOf(textRange.endOffset - textRange.startOffset)
|
||||
)
|
||||
)
|
||||
|
||||
// These data provided by {@link com.intellij.openapi.editor.richcopy.TextWithMarkupProcessor} doesn't work with
|
||||
// IdeaVim and I don't see a way to fix it
|
||||
@ -241,6 +260,6 @@ internal class IjClipboardManager : VimClipboardManager {
|
||||
}
|
||||
}
|
||||
|
||||
data class IjVimCopiedText(override val text: String, val transferableData: List<Any>): VimCopiedText {
|
||||
data class IjVimCopiedText(override val text: String, val transferableData: List<Any>) : VimCopiedText {
|
||||
override fun updateText(newText: String): VimCopiedText = IjVimCopiedText(newText, transferableData)
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ internal class IjVimCaret(val caret: Caret) : VimCaretBase() {
|
||||
set(value) {
|
||||
caret.vimLastColumn = value
|
||||
}
|
||||
|
||||
override fun resetLastColumn() = caret.resetVimLastColumn()
|
||||
override val selectionStart: Int
|
||||
get() = caret.selectionStart
|
||||
|
@ -386,7 +386,7 @@ internal class IjVimEditor(editor: Editor) : MutableLinearEditor, VimEditorBase(
|
||||
}
|
||||
|
||||
override fun extractProtocol(): String? {
|
||||
return EditorHelper.getVirtualFile(editor)?.getUrl()?.let { VirtualFileManager.extractProtocol(it) }
|
||||
return EditorHelper.getVirtualFile(editor)?.url?.let { VirtualFileManager.extractProtocol(it) }
|
||||
}
|
||||
|
||||
override val projectId = editor.project?.let { injector.file.getProjectId(it) } ?: DEFAULT_PROJECT_ID
|
||||
@ -536,7 +536,7 @@ val VimEditor.ij: Editor
|
||||
val com.intellij.openapi.util.TextRange.vim: TextRange
|
||||
get() = TextRange(this.startOffset, this.endOffset)
|
||||
|
||||
internal class InsertTimeRecorder: ModeChangeListener {
|
||||
internal class InsertTimeRecorder : ModeChangeListener {
|
||||
override fun modeChanged(editor: VimEditor, oldMode: Mode) {
|
||||
editor as IjVimEditor
|
||||
if (oldMode == Mode.INSERT) {
|
||||
|
@ -41,8 +41,7 @@ internal class IjVimMessages : VimMessagesBase() {
|
||||
val project = editor?.ij?.project
|
||||
if (project != null) {
|
||||
setStatusBarMessage(project, message)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// TODO: We really shouldn't set the status bar text for other projects. That's rude.
|
||||
ProjectManager.getInstance().openProjects.forEach {
|
||||
setStatusBarMessage(it, message)
|
||||
|
@ -277,7 +277,11 @@ open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateComponent<Ele
|
||||
}
|
||||
}
|
||||
|
||||
(injector.searchGroup as VimSearchGroupBase).highlightSearchLines(editor.vim, startPosition.line, endPosition.line)
|
||||
(injector.searchGroup as VimSearchGroupBase).highlightSearchLines(
|
||||
editor.vim,
|
||||
startPosition.line,
|
||||
endPosition.line
|
||||
)
|
||||
|
||||
if (logger.isDebug()) {
|
||||
existingHighlighters = editor.vimLastHighlighters!!
|
||||
|
@ -45,8 +45,7 @@ internal class IjVimSearchHelper : VimSearchHelperBase() {
|
||||
endOffset = caret.offset - 1
|
||||
skipCount = -count - 1
|
||||
offsetOrdering = IntComparators.OPPOSITE_COMPARATOR
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
startOffset = caret.offset + 1
|
||||
endOffset = editor.ij.document.textLength
|
||||
skipCount = count - 1
|
||||
|
@ -29,7 +29,13 @@ internal class ShortcutConflictState : ApplicationUsagesCollector() {
|
||||
val metrics = mutableSetOf<MetricEvent>()
|
||||
keyStrokes.forEach { keystroke ->
|
||||
getHandlersForShortcut(keystroke)
|
||||
.filter { !setOf(HandledModes.INSERT_UNDEFINED, HandledModes.NORMAL_UNDEFINED, HandledModes.VISUAL_AND_SELECT_UNDEFINED).contains(it) }
|
||||
.filter {
|
||||
!setOf(
|
||||
HandledModes.INSERT_UNDEFINED,
|
||||
HandledModes.NORMAL_UNDEFINED,
|
||||
HandledModes.VISUAL_AND_SELECT_UNDEFINED
|
||||
).contains(it)
|
||||
}
|
||||
.forEach { mode ->
|
||||
metrics += HANDLER.metric(keystroke.toReadableString(), mode)
|
||||
}
|
||||
@ -38,14 +44,32 @@ internal class ShortcutConflictState : ApplicationUsagesCollector() {
|
||||
}
|
||||
|
||||
private fun getHandlersForShortcut(shortcut: KeyStroke): List<HandledModes> {
|
||||
val modes = VimPlugin.getKey().shortcutConflicts[shortcut] ?: return listOf(HandledModes.NORMAL_UNDEFINED, HandledModes.INSERT_UNDEFINED, HandledModes.VISUAL_AND_SELECT_UNDEFINED)
|
||||
val modes = VimPlugin.getKey().shortcutConflicts[shortcut] ?: return listOf(
|
||||
HandledModes.NORMAL_UNDEFINED,
|
||||
HandledModes.INSERT_UNDEFINED,
|
||||
HandledModes.VISUAL_AND_SELECT_UNDEFINED
|
||||
)
|
||||
|
||||
return when (modes) {
|
||||
is ShortcutOwnerInfo.AllModes -> {
|
||||
when (modes.owner) {
|
||||
ShortcutOwner.IDE -> listOf(HandledModes.NORMAL_IDE, HandledModes.INSERT_IDE, HandledModes.VISUAL_AND_SELECT_IDE)
|
||||
ShortcutOwner.VIM -> listOf(HandledModes.NORMAL_VIM, HandledModes.INSERT_VIM, HandledModes.VISUAL_AND_SELECT_VIM)
|
||||
ShortcutOwner.UNDEFINED -> listOf(HandledModes.NORMAL_UNDEFINED, HandledModes.INSERT_UNDEFINED, HandledModes.VISUAL_AND_SELECT_UNDEFINED)
|
||||
ShortcutOwner.IDE -> listOf(
|
||||
HandledModes.NORMAL_IDE,
|
||||
HandledModes.INSERT_IDE,
|
||||
HandledModes.VISUAL_AND_SELECT_IDE
|
||||
)
|
||||
|
||||
ShortcutOwner.VIM -> listOf(
|
||||
HandledModes.NORMAL_VIM,
|
||||
HandledModes.INSERT_VIM,
|
||||
HandledModes.VISUAL_AND_SELECT_VIM
|
||||
)
|
||||
|
||||
ShortcutOwner.UNDEFINED -> listOf(
|
||||
HandledModes.NORMAL_UNDEFINED,
|
||||
HandledModes.INSERT_UNDEFINED,
|
||||
HandledModes.VISUAL_AND_SELECT_UNDEFINED
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,8 @@ internal class VimscriptState : ApplicationUsagesCollector() {
|
||||
return setOf(
|
||||
VIMSCRIPT.metric(
|
||||
SOURCED_FILES with Util.sourcedFiles.size,
|
||||
IDEAVIMRC_SIZE with (VimRcService.findIdeaVimRc()?.readLines()?.filter { !it.matches(Regex("\\s*\".*")) && it.isNotBlank() }?.size ?: -1),
|
||||
IDEAVIMRC_SIZE with (VimRcService.findIdeaVimRc()?.readLines()
|
||||
?.filter { !it.matches(Regex("\\s*\".*")) && it.isNotBlank() }?.size ?: -1),
|
||||
EXTENSIONS_ENABLED_BY_SET with (PluginState.Util.enabledExtensions - Util.extensionsEnabledWithPlug).toList(),
|
||||
EXTENSIONS_ENABLED_BY_PLUG with Util.extensionsEnabledWithPlug.toList(),
|
||||
IS_IDE_SPECIFIC_CONFIGURATION_USED with Util.isIDESpecificConfigurationUsed,
|
||||
|
@ -58,8 +58,10 @@ class WidgetState : ApplicationUsagesCollector() {
|
||||
private val GROUP = EventLogGroup("vim.widget", 1, "FUS")
|
||||
|
||||
private val IS_MODE_WIDGET_SHOWN = EventFields.Boolean("is-mode-widget-shown")
|
||||
private val MODE_WIDGET_THEME_LIGHT = EventFields.String("mode-widget-theme-light", listOf("TERM", "COLORLESS", "ADVANCED CUSTOMIZATION"))
|
||||
private val MODE_WIDGET_THEME_DARK = EventFields.String("mode-widget-theme-dark", listOf("TERM", "COLORLESS", "ADVANCED CUSTOMIZATION"))
|
||||
private val MODE_WIDGET_THEME_LIGHT =
|
||||
EventFields.String("mode-widget-theme-light", listOf("TERM", "COLORLESS", "ADVANCED CUSTOMIZATION"))
|
||||
private val MODE_WIDGET_THEME_DARK =
|
||||
EventFields.String("mode-widget-theme-dark", listOf("TERM", "COLORLESS", "ADVANCED CUSTOMIZATION"))
|
||||
|
||||
private val WIDGET: VarargEventId = GROUP.registerVarargEvent(
|
||||
"vim.widget",
|
||||
|
@ -259,7 +259,8 @@ public class ExOutputPanel extends JPanel {
|
||||
|
||||
public boolean isAtEnd() {
|
||||
int val = myScrollPane.getVerticalScrollBar().getValue();
|
||||
return val >= myScrollPane.getVerticalScrollBar().getMaximum() - myScrollPane.getVerticalScrollBar().getVisibleAmount();
|
||||
return val >=
|
||||
myScrollPane.getVerticalScrollBar().getMaximum() - myScrollPane.getVerticalScrollBar().getVisibleAmount();
|
||||
}
|
||||
|
||||
private void positionPanel() {
|
||||
@ -316,8 +317,10 @@ public class ExOutputPanel extends JPanel {
|
||||
KeyHandler.getInstance().getKeyStack().dump());
|
||||
}
|
||||
KeyHandler.getInstance().getKeyStack().addKeys(keys);
|
||||
ExecutionContext context = injector.getExecutionContextManager().getEditorExecutionContext(new IjVimEditor(myEditor));
|
||||
injector.getApplication().runWriteAction(() -> { VimPlugin.getMacro().playbackKeys(new IjVimEditor(myEditor), context, 1);
|
||||
ExecutionContext context =
|
||||
injector.getExecutionContextManager().getEditorExecutionContext(new IjVimEditor(myEditor));
|
||||
injector.getApplication().runWriteAction(() -> {
|
||||
VimPlugin.getMacro().playbackKeys(new IjVimEditor(myEditor), context, 1);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -342,7 +345,9 @@ public class ExOutputPanel extends JPanel {
|
||||
int keyCode = e.getKeyCode();
|
||||
Character keyChar = e.getKeyChar();
|
||||
int modifiers = e.getModifiersEx();
|
||||
KeyStroke keyStroke = (keyChar == KeyEvent.CHAR_UNDEFINED) ? KeyStroke.getKeyStroke(keyCode, modifiers) : KeyStroke.getKeyStroke(keyChar, modifiers);
|
||||
KeyStroke keyStroke = (keyChar == KeyEvent.CHAR_UNDEFINED)
|
||||
? KeyStroke.getKeyStroke(keyCode, modifiers)
|
||||
: KeyStroke.getKeyStroke(keyChar, modifiers);
|
||||
currentPanel.handleKey(keyStroke);
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +267,8 @@ private class HelpLink(
|
||||
}
|
||||
}
|
||||
|
||||
private object ShortcutConflictsSettings : DumbAwareAction(MessageHelper.message("action.settings.text"))/*, LightEditCompatible*/ {
|
||||
private object ShortcutConflictsSettings :
|
||||
DumbAwareAction(MessageHelper.message("action.settings.text"))/*, LightEditCompatible*/ {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
ShowSettingsUtil.getInstance().showSettingsDialog(e.project, VimEmulationConfigurable::class.java)
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ internal class VimEmulationConfigurable : Configurable {
|
||||
}
|
||||
}
|
||||
|
||||
return rowsToChange;
|
||||
return rowsToChange
|
||||
}
|
||||
|
||||
fun addHelpLine(model: VimShortcutConflictsTable.Model) {
|
||||
|
@ -34,7 +34,7 @@ public class ExDocument extends PlainDocument {
|
||||
void toggleInsertReplace() {
|
||||
VimCommandLine commandLine = injector.getCommandLine().getActiveCommandLine();
|
||||
if (commandLine != null) {
|
||||
((ExEntryPanel) commandLine).isReplaceMode = !((ExEntryPanel)commandLine).isReplaceMode;
|
||||
((ExEntryPanel)commandLine).isReplaceMode = !((ExEntryPanel)commandLine).isReplaceMode;
|
||||
}
|
||||
overwrite = !overwrite;
|
||||
}
|
||||
|
@ -49,7 +49,9 @@ internal object ExEditorKit : DefaultEditorKit() {
|
||||
val c = key.keyChar
|
||||
if (c.code > 0) {
|
||||
if (target.useHandleKeyFromEx) {
|
||||
val panel = ((injector.commandLine.getActiveCommandLine() as? ExEntryPanel) ?: (injector.modalInput.getCurrentModalInput() as? WrappedAsModalInputExEntryPanel)?.exEntryPanel) ?: return
|
||||
val panel = ((injector.commandLine.getActiveCommandLine() as? ExEntryPanel)
|
||||
?: (injector.modalInput.getCurrentModalInput() as? WrappedAsModalInputExEntryPanel)?.exEntryPanel)
|
||||
?: return
|
||||
val entry = panel.entry
|
||||
val editor = entry.editor
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
|
@ -88,11 +88,8 @@ public class ExEntryPanel extends JPanel implements VimCommandLine {
|
||||
add(entry);
|
||||
|
||||
// This does not need to be unregistered, it's registered as a custom UI property on this
|
||||
EventFacade.getInstance().registerCustomShortcutSet(
|
||||
VimShortcutKeyAction.getInstance(),
|
||||
toShortcutSet(((VimKeyGroupBase) injector.getKeyGroup()).getRequiredShortcutKeys()),
|
||||
entry
|
||||
);
|
||||
EventFacade.getInstance().registerCustomShortcutSet(VimShortcutKeyAction.getInstance(), toShortcutSet(
|
||||
((VimKeyGroupBase)injector.getKeyGroup()).getRequiredShortcutKeys()), entry);
|
||||
new ExShortcutKeyAction(this).registerCustomShortcutSet();
|
||||
|
||||
updateUI();
|
||||
@ -148,7 +145,8 @@ public class ExEntryPanel extends JPanel implements VimCommandLine {
|
||||
public void setEditor(@Nullable Editor editor) {
|
||||
if (editor == null) {
|
||||
weakEditor = null;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
weakEditor = new WeakReference<>(editor);
|
||||
}
|
||||
}
|
||||
@ -331,9 +329,9 @@ public class ExEntryPanel extends JPanel implements VimCommandLine {
|
||||
searchText = argument.substring(1);
|
||||
}
|
||||
if (!searchText.isEmpty()) {
|
||||
searchRange = command.getLineRangeSafe(new IjVimEditor(editor));
|
||||
}
|
||||
if (searchText.isEmpty() || searchRange == null) {
|
||||
searchRange = command.getLineRangeSafe(new IjVimEditor(editor));
|
||||
}
|
||||
if (searchText.isEmpty() || searchRange == null) {
|
||||
// Reset back to the original search highlights after deleting a search from a substitution command.Or if
|
||||
// there is no search range (because the user entered an invalid range, e.g. mark not set).
|
||||
// E.g. Highlight `whatever`, type `:%s/foo` + highlight `foo`, delete back to `:%s/` and reset highlights
|
||||
@ -385,7 +383,7 @@ public class ExEntryPanel extends JPanel implements VimCommandLine {
|
||||
return exCommand;
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
catch (Exception e) {
|
||||
logger.warn("Cannot parse command for incsearch", e);
|
||||
}
|
||||
|
||||
@ -533,7 +531,7 @@ public class ExEntryPanel extends JPanel implements VimCommandLine {
|
||||
|
||||
@Override
|
||||
public @NotNull VimCommandLineCaret getCaret() {
|
||||
return (VimCommandLineCaret) entry.getCaret();
|
||||
return (VimCommandLineCaret)entry.getCaret();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,17 +72,20 @@ class ExEntryPanelService : VimCommandLineServiceBase(), VimModalInputService {
|
||||
commandLine.deactivate(refocusOwningEditor = true, resetCaret = true)
|
||||
false
|
||||
}
|
||||
|
||||
key.keyCode == KeyEvent.VK_ENTER -> {
|
||||
text = commandLine.actualText
|
||||
commandLine.deactivate(refocusOwningEditor = true, resetCaret = true)
|
||||
false
|
||||
}
|
||||
|
||||
finishOn != null && key.keyChar == finishOn -> {
|
||||
commandLine.handleKey(key)
|
||||
text = commandLine.actualText
|
||||
commandLine.deactivate(refocusOwningEditor = true, resetCaret = true)
|
||||
false
|
||||
}
|
||||
|
||||
else -> {
|
||||
commandLine.handleKey(key)
|
||||
true
|
||||
@ -126,7 +129,12 @@ class ExEntryPanelService : VimCommandLineServiceBase(), VimModalInputService {
|
||||
panel.activate(editor.ij, context.ij, prompt, "")
|
||||
}
|
||||
|
||||
override fun createPanel(editor: VimEditor, context: ExecutionContext, label: String, initText: String): VimCommandLine {
|
||||
override fun createPanel(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
label: String,
|
||||
initText: String,
|
||||
): VimCommandLine {
|
||||
val panel = ExEntryPanel.getInstance()
|
||||
panel.activate(editor.ij, context.ij, label, initText)
|
||||
return panel
|
||||
@ -137,10 +145,16 @@ class ExEntryPanelService : VimCommandLineServiceBase(), VimModalInputService {
|
||||
}
|
||||
|
||||
override fun getCurrentModalInput(): VimModalInput? {
|
||||
return ExEntryPanel.getInstanceWithoutShortcuts()?.takeIf { it.isActive && it.inputInterceptor != null }?.let { WrappedAsModalInputExEntryPanel(it) }
|
||||
return ExEntryPanel.getInstanceWithoutShortcuts()?.takeIf { it.isActive && it.inputInterceptor != null }
|
||||
?.let { WrappedAsModalInputExEntryPanel(it) }
|
||||
}
|
||||
|
||||
override fun create(editor: VimEditor, context: ExecutionContext, label: String, inputInterceptor: VimInputInterceptor<*>): VimModalInput {
|
||||
override fun create(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
label: String,
|
||||
inputInterceptor: VimInputInterceptor<*>,
|
||||
): VimModalInput {
|
||||
val panel = ExEntryPanel.getInstanceWithoutShortcuts()
|
||||
panel.inputInterceptor = inputInterceptor
|
||||
panel.activate(editor.ij, context.ij, label, "")
|
||||
@ -151,7 +165,9 @@ class ExEntryPanelService : VimCommandLineServiceBase(), VimModalInputService {
|
||||
internal class WrappedAsModalInputExEntryPanel(internal val exEntryPanel: ExEntryPanel) : VimModalInputBase() {
|
||||
override var inputInterceptor: VimInputInterceptor<*>
|
||||
get() = exEntryPanel.inputInterceptor!!
|
||||
set(value) { exEntryPanel.inputInterceptor = value }
|
||||
set(value) {
|
||||
exEntryPanel.inputInterceptor = value
|
||||
}
|
||||
override val caret: VimCommandLineCaret = exEntryPanel.caret
|
||||
override val label: String = exEntryPanel.label
|
||||
|
||||
|
@ -60,41 +60,41 @@ internal class ExShortcutKeyAction(private val exEntryPanel: ExEntryPanel) : Dum
|
||||
|
||||
fun registerCustomShortcutSet() {
|
||||
val shortcuts = listOf(
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_J, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_END, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.META_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_J, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_END, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.SHIFT_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.META_DOWN_MASK),
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, KeyEvent.SHIFT_DOWN_MASK),
|
||||
)
|
||||
.map { KeyboardShortcut(it, null) }
|
||||
.toTypedArray()
|
||||
|
@ -239,14 +239,16 @@ public class ExTextField extends JTextField {
|
||||
// This gets called for ALL events, before the IDE starts to process key events for the action system. We can add a
|
||||
// dispatcher that checks that the plugin is enabled, checks that the component with the focus is ExTextField,
|
||||
// dispatch to ExEntryPanel#handleKey and if it's processed, mark the event as consumed.
|
||||
KeyEvent event = new KeyEvent(this, keyChar != KeyEvent.CHAR_UNDEFINED ? KeyEvent.KEY_TYPED :
|
||||
(stroke.isOnKeyRelease() ? KeyEvent.KEY_RELEASED : KeyEvent.KEY_PRESSED),
|
||||
KeyEvent event = new KeyEvent(this, keyChar != KeyEvent.CHAR_UNDEFINED
|
||||
? KeyEvent.KEY_TYPED
|
||||
: (stroke.isOnKeyRelease() ? KeyEvent.KEY_RELEASED : KeyEvent.KEY_PRESSED),
|
||||
(new Date()).getTime(), modifiers, keyCode, c);
|
||||
|
||||
useHandleKeyFromEx = false;
|
||||
try {
|
||||
super.processKeyEvent(event);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
useHandleKeyFromEx = true;
|
||||
}
|
||||
}
|
||||
@ -311,7 +313,8 @@ public class ExTextField extends JTextField {
|
||||
}
|
||||
|
||||
private void resetCaret() {
|
||||
if (getCaretPosition() == super.getText().length() || currentActionPromptCharacterOffset == super.getText().length() - 1) {
|
||||
if (getCaretPosition() == super.getText().length() ||
|
||||
currentActionPromptCharacterOffset == super.getText().length() - 1) {
|
||||
setNormalModeCaret();
|
||||
}
|
||||
else {
|
||||
@ -388,7 +391,7 @@ public class ExTextField extends JTextField {
|
||||
if (!isVisible()) return;
|
||||
|
||||
// Take a copy of the graphics, so we can mess around with it without having to reset after
|
||||
final Graphics2D g2d = (Graphics2D) g.create();
|
||||
final Graphics2D g2d = (Graphics2D)g.create();
|
||||
try {
|
||||
final JTextComponent component = getComponent();
|
||||
|
||||
@ -414,10 +417,12 @@ public class ExTextField extends JTextField {
|
||||
// when the caret has not yet been moved or changed
|
||||
final FontMetrics fm = component.getFontMetrics(component.getFont());
|
||||
if (!hasFocus) {
|
||||
final float outlineThickness = (float) PaintUtil.alignToInt(1.0, g2d);
|
||||
final float outlineThickness = (float)PaintUtil.alignToInt(1.0, g2d);
|
||||
final double caretWidth = getCaretWidth(fm, r.getX(), 100);
|
||||
final Area area = new Area(new Rectangle2D.Double(r.getX(), r.getY(), caretWidth, r.getHeight()));
|
||||
area.subtract(new Area(new Rectangle2D.Double(r.getX() + outlineThickness, r.getY() + outlineThickness, caretWidth - (2 * outlineThickness), r.getHeight() - (2 * outlineThickness))));
|
||||
area.subtract(new Area(new Rectangle2D.Double(r.getX() + outlineThickness, r.getY() + outlineThickness,
|
||||
caretWidth - (2 * outlineThickness),
|
||||
r.getHeight() - (2 * outlineThickness))));
|
||||
g2d.fill(area);
|
||||
}
|
||||
else {
|
||||
@ -516,7 +521,7 @@ public class ExTextField extends JTextField {
|
||||
|
||||
@TestOnly
|
||||
public @NonNls String getCaretShape() {
|
||||
CommandLineCaret caret = (CommandLineCaret) getCaret();
|
||||
CommandLineCaret caret = (CommandLineCaret)getCaret();
|
||||
return String.format("%s %d", caret.mode, caret.thickness);
|
||||
}
|
||||
|
||||
|
@ -121,26 +121,26 @@ class ModeWidgetPopup : AnAction() {
|
||||
return ModeColors(
|
||||
"widget_mode_is_full_customization$keyPostfix",
|
||||
"widget_mode_theme$keyPostfix",
|
||||
"widget_mode_normal_background$keyPostfix",
|
||||
"widget_mode_normal_foreground$keyPostfix",
|
||||
"widget_mode_insert_background$keyPostfix",
|
||||
"widget_mode_insert_foreground$keyPostfix",
|
||||
"widget_mode_replace_background$keyPostfix",
|
||||
"widget_mode_replace_foreground$keyPostfix",
|
||||
"widget_mode_command_background$keyPostfix",
|
||||
"widget_mode_command_foreground$keyPostfix",
|
||||
"widget_mode_visual_background$keyPostfix",
|
||||
"widget_mode_visual_foreground$keyPostfix",
|
||||
"widget_mode_visual_line_background$keyPostfix",
|
||||
"widget_mode_visual_line_foreground$keyPostfix",
|
||||
"widget_mode_visual_block_background$keyPostfix",
|
||||
"widget_mode_visual_block_foreground$keyPostfix",
|
||||
"widget_mode_select_background$keyPostfix",
|
||||
"widget_mode_select_foreground$keyPostfix",
|
||||
"widget_mode_select_line_background$keyPostfix",
|
||||
"widget_mode_select_line_foreground$keyPostfix",
|
||||
"widget_mode_select_block_background$keyPostfix",
|
||||
"widget_mode_select_block_foreground$keyPostfix",
|
||||
"widget_mode_normal_background$keyPostfix",
|
||||
"widget_mode_normal_foreground$keyPostfix",
|
||||
"widget_mode_insert_background$keyPostfix",
|
||||
"widget_mode_insert_foreground$keyPostfix",
|
||||
"widget_mode_replace_background$keyPostfix",
|
||||
"widget_mode_replace_foreground$keyPostfix",
|
||||
"widget_mode_command_background$keyPostfix",
|
||||
"widget_mode_command_foreground$keyPostfix",
|
||||
"widget_mode_visual_background$keyPostfix",
|
||||
"widget_mode_visual_foreground$keyPostfix",
|
||||
"widget_mode_visual_line_background$keyPostfix",
|
||||
"widget_mode_visual_line_foreground$keyPostfix",
|
||||
"widget_mode_visual_block_background$keyPostfix",
|
||||
"widget_mode_visual_block_foreground$keyPostfix",
|
||||
"widget_mode_select_background$keyPostfix",
|
||||
"widget_mode_select_foreground$keyPostfix",
|
||||
"widget_mode_select_line_background$keyPostfix",
|
||||
"widget_mode_select_line_foreground$keyPostfix",
|
||||
"widget_mode_select_block_background$keyPostfix",
|
||||
"widget_mode_select_block_foreground$keyPostfix",
|
||||
)
|
||||
}
|
||||
|
||||
@ -148,14 +148,20 @@ class ModeWidgetPopup : AnAction() {
|
||||
val panel = panel {
|
||||
lateinit var advancedSettings: Cell<JBCheckBox>
|
||||
row {
|
||||
advancedSettings = checkBox(MessageHelper.getMessage("widget.mode.popup.field.advanced.settings")).bindSelected(modeColors::isFullCustomization)
|
||||
advancedSettings =
|
||||
checkBox(MessageHelper.getMessage("widget.mode.popup.field.advanced.settings")).bindSelected(modeColors::isFullCustomization)
|
||||
}
|
||||
group {
|
||||
row {
|
||||
label(MessageHelper.getMessage("widget.mode.popup.field.theme"))
|
||||
comboBox(ModeWidgetTheme.entries).bindItem(modeColors::theme.toNullableProperty())
|
||||
}
|
||||
row { browserLink("Suggest your theme", "https://youtrack.jetbrains.com/issue/VIM-1377/Normal-mode-needs-to-be-more-obvious") }
|
||||
row {
|
||||
browserLink(
|
||||
"Suggest your theme",
|
||||
"https://youtrack.jetbrains.com/issue/VIM-1377/Normal-mode-needs-to-be-more-obvious"
|
||||
)
|
||||
}
|
||||
}.topGap(TopGap.NONE).visibleIf(!advancedSettings.selected)
|
||||
group(MessageHelper.getMessage("widget.mode.popup.group.title.full.customization")) {
|
||||
row { text(MessageHelper.getMessage("widget.mode.popup.color.instruction")) }
|
||||
@ -279,7 +285,8 @@ class ModeWidgetPopup : AnAction() {
|
||||
}
|
||||
|
||||
private fun JComponent.addScrollPane(): JComponent {
|
||||
val scrollPane = JBScrollPane(this, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER)
|
||||
val scrollPane =
|
||||
JBScrollPane(this, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER)
|
||||
scrollPane.border = BorderFactory.createEmptyBorder()
|
||||
return scrollPane
|
||||
}
|
||||
@ -317,7 +324,7 @@ class ModeWidgetPopup : AnAction() {
|
||||
var selectBlockBg: String by VimScopeStringVariable(selectBlockBgKey)
|
||||
var selectBlockFg: String by VimScopeStringVariable(selectBlockFgKey)
|
||||
|
||||
private class VimScopeBooleanVariable(private var key: String): ReadWriteProperty<ModeColors, Boolean> {
|
||||
private class VimScopeBooleanVariable(private var key: String) : ReadWriteProperty<ModeColors, Boolean> {
|
||||
override fun getValue(thisRef: ModeColors, property: KProperty<*>): Boolean {
|
||||
return injector.variableService.getVimVariable(key)?.asBoolean() ?: false
|
||||
}
|
||||
@ -327,7 +334,7 @@ class ModeWidgetPopup : AnAction() {
|
||||
}
|
||||
}
|
||||
|
||||
private class VimScopeStringVariable(private var key: String): ReadWriteProperty<ModeColors, String> {
|
||||
private class VimScopeStringVariable(private var key: String) : ReadWriteProperty<ModeColors, String> {
|
||||
override fun getValue(thisRef: ModeColors, property: KProperty<*>): String {
|
||||
return injector.variableService.getVimVariable(key)?.asString() ?: ""
|
||||
}
|
||||
@ -337,9 +344,10 @@ class ModeWidgetPopup : AnAction() {
|
||||
}
|
||||
}
|
||||
|
||||
private class VimScopeThemeVariable(private var key: String): ReadWriteProperty<ModeColors, ModeWidgetTheme> {
|
||||
private class VimScopeThemeVariable(private var key: String) : ReadWriteProperty<ModeColors, ModeWidgetTheme> {
|
||||
override fun getValue(thisRef: ModeColors, property: KProperty<*>): ModeWidgetTheme {
|
||||
val themeString = injector.variableService.getVimVariable(key)?.asString() ?: return ModeWidgetTheme.getDefaultTheme()
|
||||
val themeString =
|
||||
injector.variableService.getVimVariable(key)?.asString() ?: return ModeWidgetTheme.getDefaultTheme()
|
||||
return ModeWidgetTheme.parseString(themeString) ?: ModeWidgetTheme.getDefaultTheme()
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ fun getModeBackground(mode: Mode?): Color {
|
||||
is Mode.OP_PENDING, null -> UIUtil.getPanelBackground()
|
||||
}
|
||||
}
|
||||
|
||||
ModeWidgetTheme.DRACULA -> {
|
||||
return when (mode) {
|
||||
Mode.INSERT -> Color.decode("#50FA7B")
|
||||
@ -41,6 +42,7 @@ fun getModeBackground(mode: Mode?): Color {
|
||||
is Mode.OP_PENDING, null -> UIUtil.getPanelBackground()
|
||||
}
|
||||
}
|
||||
|
||||
ModeWidgetTheme.COLORLESS -> {
|
||||
return UIUtil.getPanelBackground()
|
||||
}
|
||||
@ -55,18 +57,26 @@ fun getModeBackground(mode: Mode?): Color {
|
||||
val visualModeBackground = injector.variableService.getVimVariable("widget_mode_visual_background$keyPostfix")
|
||||
when (mode.selectionType) {
|
||||
SelectionType.CHARACTER_WISE -> visualModeBackground
|
||||
SelectionType.LINE_WISE -> injector.variableService.getVimVariable("widget_mode_visual_line_background$keyPostfix") ?: visualModeBackground
|
||||
SelectionType.BLOCK_WISE -> injector.variableService.getVimVariable("widget_mode_visual_block_background$keyPostfix") ?: visualModeBackground
|
||||
SelectionType.LINE_WISE -> injector.variableService.getVimVariable("widget_mode_visual_line_background$keyPostfix")
|
||||
?: visualModeBackground
|
||||
|
||||
SelectionType.BLOCK_WISE -> injector.variableService.getVimVariable("widget_mode_visual_block_background$keyPostfix")
|
||||
?: visualModeBackground
|
||||
}
|
||||
}
|
||||
|
||||
is Mode.SELECT -> {
|
||||
val selectModeBackground = injector.variableService.getVimVariable("widget_mode_select_background$keyPostfix")
|
||||
when (mode.selectionType) {
|
||||
SelectionType.CHARACTER_WISE -> selectModeBackground
|
||||
SelectionType.LINE_WISE -> injector.variableService.getVimVariable("widget_mode_select_line_background$keyPostfix") ?: selectModeBackground
|
||||
SelectionType.BLOCK_WISE -> injector.variableService.getVimVariable("widget_mode_select_block_background$keyPostfix") ?: selectModeBackground
|
||||
SelectionType.LINE_WISE -> injector.variableService.getVimVariable("widget_mode_select_line_background$keyPostfix")
|
||||
?: selectModeBackground
|
||||
|
||||
SelectionType.BLOCK_WISE -> injector.variableService.getVimVariable("widget_mode_select_block_background$keyPostfix")
|
||||
?: selectModeBackground
|
||||
}
|
||||
}
|
||||
|
||||
is Mode.OP_PENDING, null -> null
|
||||
}?.asString()
|
||||
val defaultColor = UIUtil.getPanelBackground()
|
||||
@ -77,7 +87,11 @@ fun getModeBackground(mode: Mode?): Color {
|
||||
if (colorString == null) {
|
||||
defaultColor
|
||||
} else {
|
||||
try { Color.decode(colorString) } catch (e: Exception) { defaultColor }
|
||||
try {
|
||||
Color.decode(colorString)
|
||||
} catch (e: Exception) {
|
||||
defaultColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -106,18 +120,26 @@ fun getModeForeground(mode: Mode?): Color {
|
||||
val visualModeBackground = injector.variableService.getVimVariable("widget_mode_visual_foreground$keyPostfix")
|
||||
when (mode.selectionType) {
|
||||
SelectionType.CHARACTER_WISE -> visualModeBackground
|
||||
SelectionType.LINE_WISE -> injector.variableService.getVimVariable("widget_mode_visual_line_foreground$keyPostfix") ?: visualModeBackground
|
||||
SelectionType.BLOCK_WISE -> injector.variableService.getVimVariable("widget_mode_visual_block_foreground$keyPostfix") ?: visualModeBackground
|
||||
SelectionType.LINE_WISE -> injector.variableService.getVimVariable("widget_mode_visual_line_foreground$keyPostfix")
|
||||
?: visualModeBackground
|
||||
|
||||
SelectionType.BLOCK_WISE -> injector.variableService.getVimVariable("widget_mode_visual_block_foreground$keyPostfix")
|
||||
?: visualModeBackground
|
||||
}
|
||||
}
|
||||
|
||||
is Mode.SELECT -> {
|
||||
val selectModeBackground = injector.variableService.getVimVariable("widget_mode_select_foreground$keyPostfix")
|
||||
when (mode.selectionType) {
|
||||
SelectionType.CHARACTER_WISE -> selectModeBackground
|
||||
SelectionType.LINE_WISE -> injector.variableService.getVimVariable("widget_mode_select_line_foreground$keyPostfix") ?: selectModeBackground
|
||||
SelectionType.BLOCK_WISE -> injector.variableService.getVimVariable("widget_mode_select_block_foreground$keyPostfix") ?: selectModeBackground
|
||||
SelectionType.LINE_WISE -> injector.variableService.getVimVariable("widget_mode_select_line_foreground$keyPostfix")
|
||||
?: selectModeBackground
|
||||
|
||||
SelectionType.BLOCK_WISE -> injector.variableService.getVimVariable("widget_mode_select_block_foreground$keyPostfix")
|
||||
?: selectModeBackground
|
||||
}
|
||||
}
|
||||
|
||||
is Mode.OP_PENDING, null -> null
|
||||
}?.asString()
|
||||
val defaultColor = UIUtil.getLabelForeground()
|
||||
@ -128,7 +150,11 @@ fun getModeForeground(mode: Mode?): Color {
|
||||
if (colorString == null) {
|
||||
defaultColor
|
||||
} else {
|
||||
try { Color.decode(colorString) } catch (e: Exception) { defaultColor }
|
||||
try {
|
||||
Color.decode(colorString)
|
||||
} catch (e: Exception) {
|
||||
defaultColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ class VimModeWidget(val project: Project) : CustomStatusBarWidget, VimStatusBarW
|
||||
return fileEditorManager.selectedTextEditor
|
||||
}
|
||||
|
||||
private class JBLabelWiderThan(private val words: Collection<String>): JBLabel("", CENTER) {
|
||||
private class JBLabelWiderThan(private val words: Collection<String>) : JBLabel("", CENTER) {
|
||||
private val wordWidth: Int
|
||||
get() {
|
||||
val fontMetrics = getFontMetrics(font)
|
||||
|
@ -25,7 +25,7 @@ import com.maddyhome.idea.vim.ui.widgets.mode.ModeWidgetFactory
|
||||
import com.maddyhome.idea.vim.ui.widgets.mode.VimModeWidget
|
||||
import com.maddyhome.idea.vim.ui.widgets.mode.updateModeWidget
|
||||
|
||||
internal class ModeWidgetListener: ModeChangeListener, EditorListener, VimWidgetListener({ updateModeWidget()}) {
|
||||
internal class ModeWidgetListener : ModeChangeListener, EditorListener, VimWidgetListener({ updateModeWidget() }) {
|
||||
override fun modeChanged(editor: VimEditor, oldMode: Mode) {
|
||||
val modeWidget = getWidget(editor) ?: return
|
||||
val editorMode = editor.mode
|
||||
|
@ -29,7 +29,11 @@ internal data class ActionListCommand(val range: Range, val modifier: CommandMod
|
||||
|
||||
override val argFlags = flags(RangeFlag.RANGE_FORBIDDEN, ArgumentFlag.ARGUMENT_OPTIONAL, Access.READ_ONLY)
|
||||
|
||||
override fun processCommand(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments): ExecutionResult {
|
||||
override fun processCommand(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
operatorArguments: OperatorArguments,
|
||||
): ExecutionResult {
|
||||
val lineSeparator = "\n"
|
||||
val searchPattern = argument.trim().lowercase(Locale.getDefault()).split("*")
|
||||
val actionManager = ActionManager.getInstance()
|
||||
|
@ -32,7 +32,11 @@ internal data class BufferCommand(val range: Range, val modifier: CommandModifie
|
||||
|
||||
override val argFlags = flags(RangeFlag.RANGE_FORBIDDEN, ArgumentFlag.ARGUMENT_OPTIONAL, Access.READ_ONLY)
|
||||
|
||||
override fun processCommand(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments): ExecutionResult {
|
||||
override fun processCommand(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
operatorArguments: OperatorArguments,
|
||||
): ExecutionResult {
|
||||
val overrideModified = modifier == CommandModifier.BANG
|
||||
val buffer = argument.trim()
|
||||
var result = true
|
||||
@ -55,6 +59,7 @@ internal data class BufferCommand(val range: Range, val modifier: CommandModifie
|
||||
VimPlugin.showMessage(MessageHelper.message("no.matching.buffer.for.0", buffer))
|
||||
result = false
|
||||
}
|
||||
|
||||
1 -> {
|
||||
if (EditorHelper.hasUnsavedChanges(editor.ij) && !overrideModified) {
|
||||
VimPlugin.showMessage(MessageHelper.message("no.write.since.last.change.add.to.override"))
|
||||
@ -63,6 +68,7 @@ internal data class BufferCommand(val range: Range, val modifier: CommandModifie
|
||||
VimPlugin.getFile().openFile(EditorHelper.getVirtualFile(editors[0].ij)!!.name, context)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
VimPlugin.showMessage(MessageHelper.message("more.than.one.match.for.0", buffer))
|
||||
result = false
|
||||
|
@ -42,7 +42,11 @@ internal data class BufferListCommand(val range: Range, val modifier: CommandMod
|
||||
val SUPPORTED_FILTERS = setOf('+', '=', 'a', '%', '#')
|
||||
}
|
||||
|
||||
override fun processCommand(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments): ExecutionResult {
|
||||
override fun processCommand(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
operatorArguments: OperatorArguments,
|
||||
): ExecutionResult {
|
||||
val arg = argument.trim()
|
||||
val filter = pruneUnsupportedFilters(arg)
|
||||
val bufferList = getBufferList(context, filter)
|
||||
|
@ -29,12 +29,16 @@ import com.maddyhome.idea.vim.vimscript.model.ExecutionResult
|
||||
* see "h :!"
|
||||
*/
|
||||
@ExCommand(command = "!")
|
||||
internal data class CmdFilterCommand(val range: Range, val modifier: CommandModifier, val argument: String)
|
||||
: Command.SingleExecution(range, modifier) {
|
||||
internal data class CmdFilterCommand(val range: Range, val modifier: CommandModifier, val argument: String) :
|
||||
Command.SingleExecution(range, modifier) {
|
||||
|
||||
override val argFlags = flags(RangeFlag.RANGE_OPTIONAL, ArgumentFlag.ARGUMENT_OPTIONAL, Access.SELF_SYNCHRONIZED)
|
||||
|
||||
override fun processCommand(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments): ExecutionResult {
|
||||
override fun processCommand(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
operatorArguments: OperatorArguments,
|
||||
): ExecutionResult {
|
||||
logger.debug("execute")
|
||||
val command = buildString {
|
||||
var inBackslash = false
|
||||
@ -48,6 +52,7 @@ internal data class CmdFilterCommand(val range: Range, val modifier: CommandModi
|
||||
}
|
||||
append(last)
|
||||
}
|
||||
|
||||
!inBackslash && c == '%' -> {
|
||||
val virtualFile = EditorHelper.getVirtualFile(editor.ij)
|
||||
if (virtualFile == null) {
|
||||
@ -60,6 +65,7 @@ internal data class CmdFilterCommand(val range: Range, val modifier: CommandModi
|
||||
}
|
||||
append(virtualFile.path)
|
||||
}
|
||||
|
||||
else -> append(c)
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,11 @@ internal data class HelpCommand(val range: Range, val modifier: CommandModifier,
|
||||
|
||||
override val argFlags = flags(RangeFlag.RANGE_OPTIONAL, ArgumentFlag.ARGUMENT_OPTIONAL, Access.READ_ONLY)
|
||||
|
||||
override fun processCommand(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments): ExecutionResult {
|
||||
override fun processCommand(
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
operatorArguments: OperatorArguments,
|
||||
): ExecutionResult {
|
||||
BrowserUtil.browse(helpTopicUrl(argument))
|
||||
return ExecutionResult.Success
|
||||
}
|
||||
|
@ -14,5 +14,6 @@ import com.maddyhome.idea.vim.vimscript.model.functions.IntellijFunctionProvider
|
||||
import com.maddyhome.idea.vim.vimscript.model.functions.VimscriptFunctionProvider
|
||||
|
||||
internal class FunctionStorage : VimScriptFunctionServiceBase() {
|
||||
override val functionProviders: List<VimscriptFunctionProvider> = listOf(EngineFunctionProvider, IntellijFunctionProvider)
|
||||
override val functionProviders: List<VimscriptFunctionProvider> =
|
||||
listOf(EngineFunctionProvider, IntellijFunctionProvider)
|
||||
}
|
||||
|
@ -28,9 +28,18 @@ import com.maddyhome.idea.vim.vimscript.model.expressions.Scope
|
||||
import com.maddyhome.idea.vim.vimscript.model.expressions.Variable
|
||||
import org.jdom.Element
|
||||
|
||||
@State(name = "VimVariables", storages = [Storage(value = "\$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)])
|
||||
@State(
|
||||
name = "VimVariables",
|
||||
storages = [Storage(value = "\$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)]
|
||||
)
|
||||
internal class IjVariableService : VimVariableServiceBase(), PersistentStateComponent<Element?> {
|
||||
override fun storeVariable(variable: Variable, value: VimDataType, editor: VimEditor, context: ExecutionContext, vimContext: VimLContext) {
|
||||
override fun storeVariable(
|
||||
variable: Variable,
|
||||
value: VimDataType,
|
||||
editor: VimEditor,
|
||||
context: ExecutionContext,
|
||||
vimContext: VimLContext,
|
||||
) {
|
||||
super.storeVariable(variable, value, editor, context, vimContext)
|
||||
|
||||
val scope = variable.scope ?: getDefaultVariableScope(vimContext)
|
||||
@ -92,6 +101,7 @@ internal class IjVariableService : VimVariableServiceBase(), PersistentStateComp
|
||||
"string" -> {
|
||||
vimVariables[variableElement.getAttributeValue("key")] = VimString(variableElement.getAttributeValue("value"))
|
||||
}
|
||||
|
||||
"int" -> {
|
||||
vimVariables[variableElement.getAttributeValue("key")] = VimInt(variableElement.getAttributeValue("value"))
|
||||
}
|
||||
|
@ -99,7 +99,8 @@
|
||||
</aliases>
|
||||
</vimExtension>
|
||||
|
||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.paragraphmotion.ParagraphMotion" name="vim-paragraph-motion">
|
||||
<vimExtension implementation="com.maddyhome.idea.vim.extension.paragraphmotion.ParagraphMotion"
|
||||
name="vim-paragraph-motion">
|
||||
<aliases>
|
||||
<alias name="https://github.com/dbakker/vim-paragraph-motion"/>
|
||||
<alias name="dbakker/vim-paragraph-motion"/>
|
||||
|
@ -13,5 +13,6 @@
|
||||
<stop offset="100%" stop-color="#087CFA"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<polygon fill="url(#ideavim_plugin-a)" fill-rule="evenodd" points="28.019 4 15.988 24.119 15.988 4 4 4 4 36 17.953 36 36 4"/>
|
||||
<polygon fill="url(#ideavim_plugin-a)" fill-rule="evenodd"
|
||||
points="28.019 4 15.988 24.119 15.988 4 4 4 4 36 17.953 36 36 4"/>
|
||||
</svg>
|
||||
|
Before (image error) Size: 667 B After (image error) Size: 678 B |
@ -6,6 +6,7 @@
|
||||
- https://opensource.org/licenses/MIT.
|
||||
-->
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40" fill-opacity="0" stroke="#6E6E6E" stroke-width="3">
|
||||
<path d="M 28.019 4 L 15.988 24.119 L 15.988 4 L 4 4 L 4 36 L 17.953 36 L 36 4z"/>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 40 40" fill-opacity="0" stroke="#6E6E6E"
|
||||
stroke-width="3">
|
||||
<path d="M 28.019 4 L 15.988 24.119 L 15.988 4 L 4 4 L 4 36 L 17.953 36 L 36 4z"/>
|
||||
</svg>
|
||||
|
Before (image error) Size: 446 B After (image error) Size: 449 B |
@ -8,5 +8,6 @@
|
||||
-->
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="16" height="16" fill="#000000">
|
||||
<path fill="#1DA1F2" d="M 25.855469 5.574219 C 24.914063 5.992188 23.902344 6.273438 22.839844 6.402344 C 23.921875 5.75 24.757813 4.722656 25.148438 3.496094 C 24.132813 4.097656 23.007813 4.535156 21.8125 4.769531 C 20.855469 3.75 19.492188 3.113281 17.980469 3.113281 C 15.082031 3.113281 12.730469 5.464844 12.730469 8.363281 C 12.730469 8.773438 12.777344 9.175781 12.867188 9.558594 C 8.503906 9.339844 4.636719 7.246094 2.046875 4.070313 C 1.59375 4.847656 1.335938 5.75 1.335938 6.714844 C 1.335938 8.535156 2.261719 10.140625 3.671875 11.082031 C 2.808594 11.054688 2 10.820313 1.292969 10.425781 C 1.292969 10.449219 1.292969 10.46875 1.292969 10.492188 C 1.292969 13.035156 3.101563 15.15625 5.503906 15.640625 C 5.0625 15.761719 4.601563 15.824219 4.121094 15.824219 C 3.78125 15.824219 3.453125 15.792969 3.132813 15.730469 C 3.800781 17.8125 5.738281 19.335938 8.035156 19.375 C 6.242188 20.785156 3.976563 21.621094 1.515625 21.621094 C 1.089844 21.621094 0.675781 21.597656 0.265625 21.550781 C 2.585938 23.039063 5.347656 23.90625 8.3125 23.90625 C 17.96875 23.90625 23.25 15.90625 23.25 8.972656 C 23.25 8.742188 23.246094 8.515625 23.234375 8.289063 C 24.261719 7.554688 25.152344 6.628906 25.855469 5.574219"/>
|
||||
<path fill="#1DA1F2"
|
||||
d="M 25.855469 5.574219 C 24.914063 5.992188 23.902344 6.273438 22.839844 6.402344 C 23.921875 5.75 24.757813 4.722656 25.148438 3.496094 C 24.132813 4.097656 23.007813 4.535156 21.8125 4.769531 C 20.855469 3.75 19.492188 3.113281 17.980469 3.113281 C 15.082031 3.113281 12.730469 5.464844 12.730469 8.363281 C 12.730469 8.773438 12.777344 9.175781 12.867188 9.558594 C 8.503906 9.339844 4.636719 7.246094 2.046875 4.070313 C 1.59375 4.847656 1.335938 5.75 1.335938 6.714844 C 1.335938 8.535156 2.261719 10.140625 3.671875 11.082031 C 2.808594 11.054688 2 10.820313 1.292969 10.425781 C 1.292969 10.449219 1.292969 10.46875 1.292969 10.492188 C 1.292969 13.035156 3.101563 15.15625 5.503906 15.640625 C 5.0625 15.761719 4.601563 15.824219 4.121094 15.824219 C 3.78125 15.824219 3.453125 15.792969 3.132813 15.730469 C 3.800781 17.8125 5.738281 19.335938 8.035156 19.375 C 6.242188 20.785156 3.976563 21.621094 1.515625 21.621094 C 1.089844 21.621094 0.675781 21.597656 0.265625 21.550781 C 2.585938 23.039063 5.347656 23.90625 8.3125 23.90625 C 17.96875 23.90625 23.25 15.90625 23.25 8.972656 C 23.25 8.742188 23.246094 8.515625 23.234375 8.289063 C 24.261719 7.554688 25.152344 6.628906 25.855469 5.574219"/>
|
||||
</svg>
|
||||
|
Before (image error) Size: 1.6 KiB After (image error) Size: 1.6 KiB |
@ -265,7 +265,7 @@ class CopyActionTest : VimTestCase() {
|
||||
@TestFor(issues = ["VIM-792"])
|
||||
fun testLineWiseClipboardYankPaste() {
|
||||
configureByText("<caret>foo\n")
|
||||
typeText("\"*yy" + "\"*p")
|
||||
typeText("\"*yy" + "\"*p")
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
@ -159,14 +159,16 @@ class MacroActionTest : VimTestCase() {
|
||||
)
|
||||
|
||||
assertRegister('b', "6@a")
|
||||
assertState("""
|
||||
assertState(
|
||||
"""
|
||||
Lorem Ipsum
|
||||
|
||||
Lorem ipsum dolor ${c}sit amet,
|
||||
consectetur adipiscing elit
|
||||
Sed in orci mauris.
|
||||
Cras id tellus in ex imperdiet egestas.
|
||||
""".trimIndent())
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -191,14 +193,16 @@ class MacroActionTest : VimTestCase() {
|
||||
|
||||
assertRegister('b', "3@a")
|
||||
assertRegister('c', "2@b")
|
||||
assertState("""
|
||||
assertState(
|
||||
"""
|
||||
Lorem Ipsum
|
||||
|
||||
Lorem ipsum dolor ${c}sit amet,
|
||||
consectetur adipiscing elit
|
||||
Sed in orci mauris.
|
||||
Cras id tellus in ex imperdiet egestas.
|
||||
""".trimIndent())
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -45,7 +45,10 @@ class MacroWithEditingTest : VimTestCase() {
|
||||
typeTextInFile(injector.parser.parseKeys("^v\$h\"wy"), "\u0001")
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
kotlin.test.assertEquals(injector.parser.parseKeys("<C-A>"), injector.registerGroup.getRegister(vimEditor, context, 'w')!!.keys)
|
||||
kotlin.test.assertEquals(
|
||||
injector.parser.parseKeys("<C-A>"),
|
||||
injector.registerGroup.getRegister(vimEditor, context, 'w')!!.keys
|
||||
)
|
||||
setText("1")
|
||||
typeText(injector.parser.parseKeys("@w"))
|
||||
waitAndAssert {
|
||||
|
@ -614,7 +614,7 @@ class MotionActionTest : VimTestCase() {
|
||||
doTest(keys, before, after, Mode.NORMAL())
|
||||
}
|
||||
|
||||
// VIM-2733
|
||||
// VIM-2733
|
||||
@Test
|
||||
fun testDeleteOuterQuoteEmptyString2() {
|
||||
val keys = listOf("da'")
|
||||
@ -665,7 +665,7 @@ class MotionActionTest : VimTestCase() {
|
||||
doTest(keys, before, after, Mode.NORMAL())
|
||||
}
|
||||
|
||||
// VIM-1427
|
||||
// VIM-1427
|
||||
@Test
|
||||
fun testDeleteOuterTagWithCount() {
|
||||
val keys = listOf("d2at")
|
||||
|
@ -2181,7 +2181,14 @@ rtyfg${c}hzxc"""
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context, '*', "fgh")
|
||||
VimPlugin.getRegister()
|
||||
.storeText(IjVimEditor(editor), context, editor.vim.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||
.storeText(
|
||||
IjVimEditor(editor),
|
||||
context,
|
||||
editor.vim.primaryCaret(),
|
||||
TextRange(16, 19),
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("\"*P"))
|
||||
val after = "fg${c}hqfg${c}hwe asd zxc rty fg${c}hfgh vbn"
|
||||
assertState(after)
|
||||
|
@ -29,77 +29,93 @@ class OperatorActionTest : VimTestCase() {
|
||||
|
||||
@Test
|
||||
fun `test operator action with function name`() {
|
||||
doTest("gxe",
|
||||
doTest(
|
||||
"gxe",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"xxxxx ipsum dolor sit amet"
|
||||
) {
|
||||
executeVimscript("""function! Redact(type)
|
||||
) {
|
||||
executeVimscript(
|
||||
"""function! Redact(type)
|
||||
| execute "normal `[v`]rx"
|
||||
|endfunction
|
||||
""".trimMargin())
|
||||
""".trimMargin()
|
||||
)
|
||||
enterCommand("noremap gx :set opfunc=Redact<CR>g@")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test operator action with character wise motion`() {
|
||||
doTest("gxe",
|
||||
doTest(
|
||||
"gxe",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"charlorem ipsum dolor sit amet"
|
||||
) {
|
||||
executeVimscript("""function! Redact(type)
|
||||
executeVimscript(
|
||||
"""function! Redact(type)
|
||||
| execute "normal i" . a:type
|
||||
|endfunction
|
||||
""".trimMargin())
|
||||
""".trimMargin()
|
||||
)
|
||||
enterCommand("noremap gx :set opfunc=Redact<CR>g@")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test operator action with linewise motion`() {
|
||||
doTest("Vgx",
|
||||
doTest(
|
||||
"Vgx",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"linelorem ipsum dolor sit amet"
|
||||
) {
|
||||
executeVimscript("""function! Redact(type)
|
||||
executeVimscript(
|
||||
"""function! Redact(type)
|
||||
| execute "normal i" . a:type
|
||||
|endfunction
|
||||
""".trimMargin())
|
||||
""".trimMargin()
|
||||
)
|
||||
enterCommand("noremap gx <Esc>:set opfunc=Redact<CR>gvg@")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test operator action with blockwise motion`() {
|
||||
doTest("<C-V>gx",
|
||||
doTest(
|
||||
"<C-V>gx",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"blocklorem ipsum dolor sit amet"
|
||||
) {
|
||||
executeVimscript("""function! Redact(type)
|
||||
executeVimscript(
|
||||
"""function! Redact(type)
|
||||
| execute "normal i" . a:type
|
||||
|endfunction
|
||||
""".trimMargin())
|
||||
""".trimMargin()
|
||||
)
|
||||
enterCommand("noremap gx <Esc>:set opfunc=Redact<CR>gvg@")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test operator action with function`() {
|
||||
doTest("gxe",
|
||||
doTest(
|
||||
"gxe",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"xxxxx ipsum dolor sit amet"
|
||||
) {
|
||||
executeVimscript("""function! Redact(type)
|
||||
executeVimscript(
|
||||
"""function! Redact(type)
|
||||
| execute "normal `[v`]rx"
|
||||
|endfunction
|
||||
""".trimMargin())
|
||||
""".trimMargin()
|
||||
)
|
||||
enterCommand("noremap gx :set opfunc=function('Redact')<CR>g@")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test operator action throws error with unknown function`() {
|
||||
doTest("gxe",
|
||||
doTest(
|
||||
"gxe",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"lorem ipsum dolor sit amet"
|
||||
) {
|
||||
@ -110,21 +126,25 @@ class OperatorActionTest : VimTestCase() {
|
||||
|
||||
@Test
|
||||
fun `test operator function with funcref`() {
|
||||
doTest("gxe",
|
||||
doTest(
|
||||
"gxe",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"xxxxx ipsum dolor sit amet"
|
||||
) {
|
||||
executeVimscript("""function! Redact(type)
|
||||
executeVimscript(
|
||||
"""function! Redact(type)
|
||||
| execute "normal `[v`]rx"
|
||||
|endfunction
|
||||
""".trimMargin())
|
||||
""".trimMargin()
|
||||
)
|
||||
enterCommand("noremap gx :set opfunc=funcref('Redact')<CR>g@")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test operator action throws error with unknown function ref`() {
|
||||
doTest("gxe",
|
||||
doTest(
|
||||
"gxe",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"lorem ipsum dolor sit amet"
|
||||
) {
|
||||
@ -140,7 +160,8 @@ class OperatorActionTest : VimTestCase() {
|
||||
// The map command is properly handled - the `<CR>g@` is correctly understood, and the full lambda is passed to the
|
||||
// parser, but the parser does not fully handle the text
|
||||
fun `test operator function with lambda`() {
|
||||
doTest("gxe",
|
||||
doTest(
|
||||
"gxe",
|
||||
"lorem ipsum dolor sit amet",
|
||||
"lorem ipsum dolor sit amet"
|
||||
) {
|
||||
|
@ -351,7 +351,8 @@ class RepeatChangeActionTest : VimTestCase() {
|
||||
@Test
|
||||
@TestFor(issues = ["VIM-481"])
|
||||
fun `test dot after overwrite mode`() {
|
||||
configureByText("""
|
||||
configureByText(
|
||||
"""
|
||||
/**
|
||||
* @param array ${'$'}arr_footers
|
||||
* @param array ${'$'}arr_totals_data
|
||||
@ -361,9 +362,11 @@ class RepeatChangeActionTest : VimTestCase() {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
""".trimIndent())
|
||||
""".trimIndent()
|
||||
)
|
||||
typeText("Rarray<C-[>", "jgell.")
|
||||
assertState("""
|
||||
assertState(
|
||||
"""
|
||||
/**
|
||||
* @param array ${'$'}arr_footers
|
||||
* @param array ${'$'}arr_totals_data
|
||||
@ -373,6 +376,7 @@ class RepeatChangeActionTest : VimTestCase() {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
""".trimIndent())
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class ChangeLineActionTest : VimTestCase() {
|
||||
Lorem ipsum dolor sit amet,
|
||||
$c
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ Mode.INSERT,
|
||||
$c
|
||||
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ Mode.INSERT,
|
||||
Lorem ipsum dolor sit amet,
|
||||
$c
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ Mode.INSERT,
|
||||
$c
|
||||
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ Mode.INSERT,
|
||||
$c
|
||||
consectetur adipiscing elit
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ Mode.INSERT,
|
||||
$c
|
||||
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ Mode.INSERT,
|
||||
consectetur adipiscing elit
|
||||
$c
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ Mode.INSERT,
|
||||
that priceless mote now dimpling the convex
|
||||
and limpid teardrop on a lighted slide.
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class ChangeMotionActionTest : VimTestCase() {
|
||||
"cc",
|
||||
"foo\n" + "${c}bar\n",
|
||||
"foo\n${c}" + "\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ Mode.INSERT,
|
||||
....${c}
|
||||
}
|
||||
""".trimIndent().dotToSpace(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ Mode.INSERT,
|
||||
"ccbaz",
|
||||
"${c}foo\n" + "bar\n",
|
||||
"baz\n" + "bar\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ Mode.INSERT,
|
||||
${c}
|
||||
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ Mode.INSERT,
|
||||
"c_baz",
|
||||
"${c}foo\n" + "bar\n",
|
||||
"baz\n" + "bar\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ Mode.INSERT,
|
||||
"cw",
|
||||
"on${c}e two three\n",
|
||||
"on${c} two three\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ Mode.INSERT,
|
||||
"c2w",
|
||||
"on${c}e two three\n",
|
||||
"on${c} three\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ Mode.INSERT,
|
||||
}
|
||||
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ Mode.INSERT,
|
||||
"cT(",
|
||||
"if (condition) ${c}{\n" + "}\n",
|
||||
"if ({\n" + "}\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ Mode.INSERT,
|
||||
"cFc",
|
||||
"if (condition) {${c}\n" + "}\n",
|
||||
"if (\n" + "}\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ Mode.INSERT,
|
||||
"cw",
|
||||
"ab.${c}cd\n",
|
||||
"ab.${c}\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ Mode.INSERT,
|
||||
listOf("c", "iw", "baz"),
|
||||
"foo bar bo${c}o\n",
|
||||
"foo bar baz\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -198,12 +198,14 @@ Mode.INSERT,
|
||||
// VIM-3729
|
||||
@Test
|
||||
fun `test change with count applies only to motion when repeated`() {
|
||||
doTest(listOf("2c3l", "foo<Esc>", "w", "."),
|
||||
doTest(
|
||||
listOf("2c3l", "foo<Esc>", "w", "."),
|
||||
"""
|
||||
banana banana
|
||||
""".trimIndent(),
|
||||
"""
|
||||
foo foo
|
||||
""".trimIndent())
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class InsertDeletePreviousWordActionTest : VimTestCase() {
|
||||
"""
|
||||
I ${c} it in a legendary land
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ Mode.INSERT,
|
||||
"""
|
||||
I ${c} in a legendary land
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ Mode.INSERT,
|
||||
"""
|
||||
Lorem Ipsum${c} found it in a legendary land
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ Mode.INSERT,
|
||||
legendary
|
||||
${c}
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ Mode.INSERT,
|
||||
listOf("a", "<C-W>"),
|
||||
"this is a sentence<caret>.\n",
|
||||
"this is a sentence<caret>\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ Mode.INSERT,
|
||||
listOf("A", "<C-W>"),
|
||||
"<caret>this is a sentence\n",
|
||||
"this is a <caret>\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ Mode.INSERT,
|
||||
listOf("A", "<C-W>"),
|
||||
"<caret>\$variable\n",
|
||||
"$<caret>\n",
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ class VisualBlockInsertActionTest : VimTestCase() {
|
||||
listOf("<C-V>", "lll", "I"),
|
||||
before.trimIndent(),
|
||||
before.trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,14 @@ class IdeaPutNotificationsTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("p"))
|
||||
|
||||
val notification = notifications().last()
|
||||
@ -55,7 +62,14 @@ class IdeaPutNotificationsTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("p"))
|
||||
|
||||
val notifications = notifications()
|
||||
@ -74,7 +88,14 @@ class IdeaPutNotificationsTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("p"))
|
||||
|
||||
val notifications = EventLog.getLogModel(fixture.project).notifications
|
||||
|
@ -88,7 +88,14 @@ class PutTestAfterCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -161,7 +168,14 @@ class PutTestAfterCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("vep"))
|
||||
val after = """
|
||||
A Discovery
|
||||
|
@ -33,7 +33,14 @@ class PutTextBeforeCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "P"))
|
||||
typeText(injector.parser.parseKeys("V" + "P"))
|
||||
val after = """
|
||||
|
@ -58,7 +58,14 @@ class PutViaIdeaTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
|
||||
typeText("ppp")
|
||||
val after = "Ilegendarylegendarylegendar${c}y found it in a legendary land"
|
||||
@ -79,13 +86,13 @@ class PutViaIdeaTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary$randomUUID",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false,
|
||||
)
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary$randomUUID",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false,
|
||||
)
|
||||
|
||||
val sizeBefore = CopyPasteManager.getInstance().allContents.size
|
||||
typeText("ve", "p")
|
||||
|
@ -78,7 +78,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||
val after = "legendar${c}y it in a legendary land"
|
||||
assertState(after)
|
||||
@ -94,7 +101,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v2e" + "2p"))
|
||||
val after = "legendarylegendar${c}y in a legendary land"
|
||||
assertState(after)
|
||||
@ -110,7 +124,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v$" + "2p"))
|
||||
val after = "legendarylegendar${c}y"
|
||||
assertState(after)
|
||||
@ -123,7 +144,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "legendary", SelectionType.CHARACTER_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "legendary", SelectionType.CHARACTER_WISE)
|
||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||
val after = "legendar${c}y legendar${c}y in a legendar${c}y land"
|
||||
assertState(after)
|
||||
@ -136,7 +157,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "legendary", SelectionType.CHARACTER_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "legendary", SelectionType.CHARACTER_WISE)
|
||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||
val after = "legendar${c}y legendar${c}y in a legendar${c}y land"
|
||||
assertState(after)
|
||||
@ -152,7 +173,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "legendary", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "legendary",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("vb" + "p"))
|
||||
val after = "I legendar${c}y it in a legendary land"
|
||||
assertState(after)
|
||||
@ -177,7 +205,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -209,7 +244,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -241,7 +283,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -273,7 +322,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v$" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -302,7 +358,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'*', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '*', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("ve" + "\"*p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -335,7 +391,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -368,7 +424,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -399,7 +455,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -430,7 +486,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("ve" + "2\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -463,7 +519,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("ve" + "2\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -506,7 +562,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -546,7 +609,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("ve" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -588,7 +658,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("ve" + "2p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -627,7 +704,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||
// registerService.storeText(editor.vim context,, editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||
val after = """
|
||||
@ -667,7 +744,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||
// registerService.storeText(editor.vim context,, editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
typeText(injector.parser.parseKeys("ve" + "\"+p"))
|
||||
val after = """
|
||||
@ -707,7 +784,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -737,7 +821,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "2p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -778,7 +869,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -816,7 +914,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'*', "Discovery", SelectionType.CHARACTER_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '*', "Discovery", SelectionType.CHARACTER_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"*p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -854,7 +952,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -892,7 +990,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -930,7 +1028,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "Discovery", SelectionType.CHARACTER_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -963,7 +1061,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -993,7 +1098,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "2p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1034,7 +1146,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1072,7 +1191,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'*', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '*', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"*p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1110,7 +1229,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1148,7 +1267,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1186,7 +1305,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "A Discovery\n", SelectionType.LINE_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1224,7 +1343,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1283,7 +1409,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1348,7 +1481,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "2p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1409,7 +1549,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1472,7 +1612,7 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
configureByText(before)
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
injector.registerGroup.storeText(vimEditor, context,'+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||
injector.registerGroup.storeText(vimEditor, context, '+', "|found|\n|l roc|\n|ere i|", SelectionType.BLOCK_WISE)
|
||||
typeText(injector.parser.parseKeys("V" + "\"+p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1532,7 +1672,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1562,7 +1709,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>3e2k" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1592,7 +1746,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "2p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1622,7 +1783,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "Discovery", SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "Discovery",
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>3j$" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1665,7 +1833,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1697,7 +1872,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "P"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1740,7 +1922,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "2p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1784,7 +1973,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2e3j" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1827,7 +2023,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), before rangeOf "A Discovery\n", SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
before rangeOf "A Discovery\n",
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2j$" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1866,7 +2069,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2e2j" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1906,7 +2116,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2e3j" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1946,7 +2163,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2ej" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -1985,7 +2209,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>elj" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
@ -2026,7 +2257,14 @@ class PutVisualTextActionTest : VimTestCase() {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), editor.rangeOf("|found|", 2), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
editor.rangeOf("|found|", 2),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-V>2j$" + "p"))
|
||||
val after = """
|
||||
A Discovery
|
||||
|
@ -34,7 +34,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 25),
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v2e" + "2gp"))
|
||||
val after = "legendarylegendary$c in a legendary land"
|
||||
assertState(after)
|
||||
@ -48,7 +55,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 25),
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v2e" + "gp"))
|
||||
val after = """
|
||||
|
||||
@ -66,7 +80,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 25),
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "gp"))
|
||||
val after = "legendary\n$c"
|
||||
assertState(after)
|
||||
@ -95,7 +116,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(2, 11), SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(2, 11),
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "gp"))
|
||||
assertState(newFile)
|
||||
}
|
||||
@ -143,7 +171,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 25),
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v2e" + "gP"))
|
||||
val after = """
|
||||
|
||||
@ -161,7 +196,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 25),
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v2e" + "2gP"))
|
||||
val after = "legendarylegendary$c in a legendary land"
|
||||
assertState(after)
|
||||
@ -175,7 +217,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 25),
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v$" + "2gP"))
|
||||
val after = "legendarylegendar${c}y"
|
||||
assertState(after)
|
||||
@ -189,7 +238,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 25), SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 25),
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("V" + "gP"))
|
||||
val after = "legendary\n$c"
|
||||
assertState(after)
|
||||
@ -294,7 +350,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.BLOCK_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 19),
|
||||
SelectionType.BLOCK_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<S-v>" + "gp"))
|
||||
val after = """
|
||||
${c}fgh
|
||||
@ -322,7 +385,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.LINE_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 19),
|
||||
SelectionType.LINE_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("<C-v>" + "h" + "gp"))
|
||||
val after = """
|
||||
q
|
||||
@ -345,7 +415,14 @@ class PutVisualTextMoveCursorActionTest : VimTestCase() {
|
||||
val vimEditor = editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
registerService.storeText(vimEditor, context, vimEditor.primaryCaret(), TextRange(16, 19), SelectionType.CHARACTER_WISE, false)
|
||||
registerService.storeText(
|
||||
vimEditor,
|
||||
context,
|
||||
vimEditor.primaryCaret(),
|
||||
TextRange(16, 19),
|
||||
SelectionType.CHARACTER_WISE,
|
||||
false
|
||||
)
|
||||
typeText(injector.parser.parseKeys("v2e" + "2gp"))
|
||||
val after = "fghfgh$c fghfgh$c fghfgh$c"
|
||||
assertState(after)
|
||||
|
@ -64,7 +64,12 @@ class YankAndPutTest : VimTestCase() {
|
||||
)
|
||||
}
|
||||
|
||||
@OptionTest(VimOption(TestOptionConstants.clipboard, limitedValues = [OptionConstants.clipboard_unnamedplus + "," + OptionConstants.clipboard_ideaput]))
|
||||
@OptionTest(
|
||||
VimOption(
|
||||
TestOptionConstants.clipboard,
|
||||
limitedValues = [OptionConstants.clipboard_unnamedplus + "," + OptionConstants.clipboard_ideaput]
|
||||
)
|
||||
)
|
||||
fun `test yank to number register with unnamedplus and ideaput`() {
|
||||
val before = """
|
||||
I ${c}found it in a legendary land
|
||||
@ -86,7 +91,12 @@ class YankAndPutTest : VimTestCase() {
|
||||
)
|
||||
}
|
||||
|
||||
@OptionTest(VimOption(TestOptionConstants.clipboard, limitedValues = [OptionConstants.clipboard_unnamed + "," + OptionConstants.clipboard_ideaput]))
|
||||
@OptionTest(
|
||||
VimOption(
|
||||
TestOptionConstants.clipboard,
|
||||
limitedValues = [OptionConstants.clipboard_unnamed + "," + OptionConstants.clipboard_ideaput]
|
||||
)
|
||||
)
|
||||
@TestWithoutPrimaryClipboard
|
||||
fun `test yank to number register with unnamed and ideaput`() {
|
||||
val before = """
|
||||
|
@ -28,7 +28,8 @@ class YankMotionActionTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
val text = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
val text =
|
||||
registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
|
||||
kotlin.test.assertEquals("and", text)
|
||||
}
|
||||
@ -127,7 +128,8 @@ class YankMotionActionTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
val text = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
val text =
|
||||
registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
|
||||
kotlin.test.assertEquals("", text)
|
||||
}
|
||||
@ -147,7 +149,8 @@ class YankMotionActionTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
val text = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
val text =
|
||||
registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
|
||||
kotlin.test.assertEquals("legendary", text)
|
||||
}
|
||||
@ -185,7 +188,8 @@ class YankMotionActionTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
val text = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
val text =
|
||||
registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
|
||||
kotlin.test.assertEquals("hard by the torrent of a mountain pass.\n", text)
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ class YankVisualLinesActionTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
val savedText = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
val savedText =
|
||||
registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
kotlin.test.assertEquals(yankedTest, savedText)
|
||||
}
|
||||
|
||||
@ -69,7 +70,8 @@ class YankVisualLinesActionTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
val savedText = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
val savedText =
|
||||
registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
kotlin.test.assertEquals(yankedTest, savedText)
|
||||
}
|
||||
|
||||
@ -93,7 +95,8 @@ class YankVisualLinesActionTest : VimTestCase() {
|
||||
val vimEditor = fixture.editor.vim
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(vimEditor)
|
||||
val registerService = injector.registerGroup
|
||||
val savedText = registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
val savedText =
|
||||
registerService.getRegister(vimEditor, context, registerService.lastRegisterChar)?.text ?: kotlin.test.fail()
|
||||
kotlin.test.assertEquals(yankedTest, savedText)
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class SearchWholeWordForwardActionTest : VimTestCase() {
|
||||
|
||||
@VimBehaviorDiffers(
|
||||
originalVimAfter =
|
||||
"""
|
||||
"""
|
||||
I found it in a legendary land
|
||||
all rocks and lavender and tufted grass,
|
||||
where it was settled on some sodden sand
|
||||
|
@ -30,7 +30,7 @@ class MotionSentenceNextStartActionTest : VimTestCase() {
|
||||
Cras id tellus in
|
||||
|
||||
""".trimIndent(),
|
||||
Mode.INSERT,
|
||||
Mode.INSERT,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user