mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-04-14 05:15:43 +02:00
Refactor commands output
This commit is contained in:
parent
689aa4cf95
commit
05852b07c6
src/main/java/com/maddyhome/idea/vim/group
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/helper
@ -40,6 +40,7 @@ import com.maddyhome.idea.vim.command.Command;
|
||||
import com.maddyhome.idea.vim.command.VimStateMachine;
|
||||
import com.maddyhome.idea.vim.ex.ExException;
|
||||
import com.maddyhome.idea.vim.ex.InvalidCommandException;
|
||||
import com.maddyhome.idea.vim.helper.EngineStringHelperKt;
|
||||
import com.maddyhome.idea.vim.helper.UiHelper;
|
||||
import com.maddyhome.idea.vim.newapi.IjExecutionContext;
|
||||
import com.maddyhome.idea.vim.newapi.IjVimEditor;
|
||||
@ -262,10 +263,9 @@ public class ProcessGroup extends VimProcessGroupBase {
|
||||
if (exitCode != null && exitCode != 0) {
|
||||
VimPlugin.showMessage("shell returned " + exitCode);
|
||||
VimPlugin.indicateError();
|
||||
return output.getStderr() + output.getStdout();
|
||||
}
|
||||
|
||||
return output.getStdout();
|
||||
return EngineStringHelperKt.removeAsciiColorCodes(output.getStderr() + output.getStdout());
|
||||
}, "IdeaVim - !" + command, true, ((IjVimEditor) editor).getEditor().getProject());
|
||||
}
|
||||
|
||||
|
@ -53,3 +53,9 @@ object EngineStringHelper {
|
||||
return c.toString()
|
||||
}
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/14652763/3124227
|
||||
fun String.removeAsciiColorCodes(): String {
|
||||
return this.replace("\u001B\\[[;\\d]*m".toRegex(), "")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user