File tree 1 file changed +11
-7
lines changed
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) {
298
298
// find scaling factor
299
299
non_selected_tab_size = (imageW - size_selected )/(codeCount -1 );
300
300
}
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
+
301
307
i = 0 ;
302
308
x = scale (6 ); // offset from left edge of the component
303
309
@@ -312,13 +318,11 @@ public void paintComponent(Graphics screen) {
312
318
font .getStringBounds (text , g .getFontRenderContext ()).getWidth ();
313
319
314
320
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 ();
322
326
}
323
327
}
324
328
You can’t perform that action at this time.
0 commit comments