File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,12 @@ public void paintComponent(Graphics screen) {
298298 // find scaling factor
299299 non_selected_tab_size = (imageW - size_selected )/(codeCount -1 );
300300 }
301+
302+ if ((non_selected_tab_size > 0 ) && (size_selected > (3 * non_selected_tab_size ))) {
303+ // limit the maximum size of tab in case of crowded tabs
304+ size_selected = 3 * non_selected_tab_size ;
305+ }
306+
301307 i = 0 ;
302308 x = scale (6 ); // offset from left edge of the component
303309
@@ -312,13 +318,11 @@ public void paintComponent(Graphics screen) {
312318 font .getStringBounds (text , g .getFontRenderContext ()).getWidth ();
313319
314320 if (non_selected_tab_size > 0 ) {
315- if (i != selected ) {
316- // find a suitable title
317- while (textWidth + 3 * PIECE_WIDTH > non_selected_tab_size && filename .length () > 2 ) {
318- filename = filename .substring (0 , filename .length ()-1 );
319- text = " " + filename + ".." + (file .isModified () ? " \u00A7 " : " " );
320- textWidth = (int )font .getStringBounds (text , g .getFontRenderContext ()).getWidth ();
321- }
321+ // find a suitable title
322+ while (textWidth + 3 * PIECE_WIDTH > ((i != selected ) ? non_selected_tab_size : size_selected ) && filename .length () > 2 ) {
323+ filename = filename .substring (0 , filename .length ()-1 );
324+ text = " " + filename + ".." + (file .isModified () ? " \u00A7 " : " " );
325+ textWidth = (int )font .getStringBounds (text , g .getFontRenderContext ()).getWidth ();
322326 }
323327 }
324328
You can’t perform that action at this time.
0 commit comments