mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-02 07:22:33 +01:00
Use EditorHelper.getScreenWidth() instead of MorePanel.getDisplayWidth()
This commit is contained in:
parent
f8781353a2
commit
a7a054f4e4
src/com/maddyhome/idea/vim
@ -20,6 +20,7 @@ package com.maddyhome.idea.vim.group;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import com.maddyhome.idea.vim.ui.MorePanel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -59,7 +60,7 @@ public class DigraphGroup {
|
||||
|
||||
private void showDigraphs(@NotNull Editor editor) {
|
||||
MorePanel panel = MorePanel.getInstance(editor);
|
||||
int width = panel.getDisplayWidth();
|
||||
int width = EditorHelper.getScreenWidth(editor);
|
||||
if (width < 10) {
|
||||
width = 80;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package com.maddyhome.idea.vim.option;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.helper.EditorHelper;
|
||||
import com.maddyhome.idea.vim.helper.MessageHelper;
|
||||
import com.maddyhome.idea.vim.helper.Msg;
|
||||
import com.maddyhome.idea.vim.ui.MorePanel;
|
||||
@ -366,7 +367,7 @@ public class Options {
|
||||
|
||||
String pad = " ";
|
||||
MorePanel panel = MorePanel.getInstance(editor);
|
||||
int width = panel.getDisplayWidth();
|
||||
int width = EditorHelper.getScreenWidth(editor);
|
||||
if (width < 20) {
|
||||
width = 80;
|
||||
}
|
||||
|
@ -110,22 +110,6 @@ public class MorePanel extends JPanel {
|
||||
return panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of characters that will fit across the 'more' window. This is useful if the text to be
|
||||
* presented in the 'more' window needs to be formatted based on the display width.
|
||||
*
|
||||
* @return The column count
|
||||
*/
|
||||
public int getDisplayWidth() {
|
||||
Container scroll = SwingUtilities.getAncestorOfClass(JScrollPane.class, myParent);
|
||||
int width = scroll.getSize().width;
|
||||
|
||||
if (ourLogger.isDebugEnabled()) ourLogger.debug("width=" + width);
|
||||
int charWidth = myText.getFontMetrics(myText.getFont()).charWidth('M');
|
||||
|
||||
return width / charWidth;
|
||||
}
|
||||
|
||||
public boolean hasText() {
|
||||
return myText.getText().length() > 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user