[ui] IJPL-148514 Alt+Click copy html tags from popup

(cherry picked from commit e134e1ba189884d280d1243bd3432189bf3fb9b6)

IJ-CR-157859

GitOrigin-RevId: d229d811b756a16a005d537bd3d38e60f10aaf7b
This commit is contained in:
Piotr Tomiak
2025-03-14 20:18:17 +01:00
committed by intellij-monorepo-bot
parent f7f0e69ecc
commit 826155474b

View File

@@ -562,12 +562,12 @@ public final class UIUtil {
/**
* Computes the minimum size the component must have to keep the given number of characters
*
* <p>
* Same as {@code computeTextComponentMinimumSize(preferredSize, text, fontMetrics, 4)}.
*
* @param preferredSize the size of the component needed to keep everything, usually computed by {@link Component#getPreferredSize()}
* @param text the currently set text
* @param fontMetrics the current font metrics
* @param preferredSize the size of the component needed to keep everything, usually computed by {@link Component#getPreferredSize()}
* @param text the currently set text
* @param fontMetrics the current font metrics
* @return the minimum size the component has to have to keep the given number of characters
*/
public static int computeTextComponentMinimumSize(
@@ -581,18 +581,19 @@ public final class UIUtil {
/**
* Computes the minimum size the component must have to keep the given number of characters
* <p>
* Intended to be used for simple {@code JLabel}-like text components.
* Often they provide the preferred size, but not the minimum size.
* This function can be used to roughly compute the minimum size based on the preferred one.
* The returned size will be reduced by the difference between the full text width and
* the width of the text contracted to just the {@code nCharactersToKeep} first characters plus {@code "..."}
* that's usually added by such components when the text doesn't fit.
* Intended to be used for simple {@code JLabel}-like text components.
* Often they provide the preferred size, but not the minimum size.
* This function can be used to roughly compute the minimum size based on the preferred one.
* The returned size will be reduced by the difference between the full text width and
* the width of the text contracted to just the {@code nCharactersToKeep} first characters plus {@code "..."}
* that's usually added by such components when the text doesn't fit.
* </p>
* <p>
* Note that, due to various factors, the result may be off by a few pixels which is enough to gain or lose an extra character.
* Because of fractional font metrics, fractional scaling, complicated calculations, rounding errors and other such things
* it's hard to make strict guarantees here.
* Note that, due to various factors, the result may be off by a few pixels which is enough to gain or lose an extra character.
* Because of fractional font metrics, fractional scaling, complicated calculations, rounding errors and other such things
* it's hard to make strict guarantees here.
* </p>
*
* @param preferredSize the size of the component needed to keep everything, usually computed by {@link Component#getPreferredSize()}
* @param text the currently set text
* @param fontMetrics the current font metrics
@@ -2610,7 +2611,7 @@ public final class UIUtil {
if (!builder.isEmpty()) {
builder.append(' ');
}
builder.append(StringUtil.removeHtmlTags(candidate).trim());
builder.append(StringUtil.removeHtmlTags(candidate, true).trim());
}
if (component instanceof Container) {
Component[] components = ((Container)component).getComponents();