Skip to content

Commit

Permalink
Added: Implement text scale disabling feature in terminal view
Browse files Browse the repository at this point in the history
The user can add `disable-terminal-view-scaling=true` entry to `termux.properties` file to disable text size scaling in terminal view.
 * The default value is `false`. Restarting the termux app or running the `termux-reload-settings` command will update the behavior instantaneously if changed.
  • Loading branch information
lkijewski committed Jan 23, 2025
1 parent 625ec4e commit 720a649
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ public boolean isTerminalViewSelected() {
}

@Override
public boolean isZoomScaleDisabled() {
return mActivity.getProperties().isZoomScaleDisabled();
public boolean isTerminalViewScalingDisabled() {
return mActivity.getProperties().isTerminalViewScalingDisabled();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public boolean onScroll(MotionEvent e, float distanceX, float distanceY) {

@Override
public boolean onScale(float focusX, float focusY, float scale) {
if (mEmulator == null || isSelectingText() || mClient.isZoomScaleDisabled()) return true;
if (mEmulator == null || isSelectingText() || mClient.isTerminalViewScalingDisabled()) return true;
mScaleFactor *= scale;
mScaleFactor = mClient.onScale(mScaleFactor);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface TerminalViewClient {

boolean isTerminalViewSelected();

boolean isZoomScaleDisabled();
boolean isTerminalViewScalingDisabled();


void copyModeChanged(boolean copyMode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
* - Add `KEY_DISABLE_FILE_SHARE_RECEIVER` and `KEY_DISABLE_FILE_VIEW_RECEIVER`.
*
* - 0.19.0 (2025-01-23)
* - Add `KEY_DISABLE_ZOOM_SCALE`.
* - Add `disable-terminal-view-scaling`.
*/

/**
Expand All @@ -102,8 +102,8 @@ public final class TermuxPropertyConstants {

/* boolean */

/** Defines the key for whether screen scaling are enabled. */
public static final String KEY_DISABLE_ZOOM_SCALE = "disable-zoom-scale"; // Default: "disable-zoom-scale"
/** Defines the key for whether terminal view scaling are enabled. */
public static final String KEY_DISABLE_TERMINAL_VIEW_SCALING = "disable-terminal-view-scaling"; // Default: "disable-terminal-view-scaling"



Expand Down Expand Up @@ -399,7 +399,7 @@ public final class TermuxPropertyConstants {
* */
public static final Set<String> TERMUX_APP_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
/* boolean */
KEY_DISABLE_ZOOM_SCALE,
KEY_DISABLE_TERMINAL_VIEW_SCALING,
KEY_DISABLE_FILE_SHARE_RECEIVER,
KEY_DISABLE_FILE_VIEW_RECEIVER,
KEY_DISABLE_HARDWARE_KEYBOARD_SHORTCUTS,
Expand Down Expand Up @@ -448,7 +448,7 @@ public final class TermuxPropertyConstants {
* default: false
*/
public static final Set<String> TERMUX_DEFAULT_FALSE_BOOLEAN_BEHAVIOUR_PROPERTIES_LIST = new HashSet<>(Arrays.asList(
KEY_DISABLE_ZOOM_SCALE,
KEY_DISABLE_TERMINAL_VIEW_SCALING,
KEY_DISABLE_FILE_SHARE_RECEIVER,
KEY_DISABLE_FILE_VIEW_RECEIVER,
KEY_DISABLE_HARDWARE_KEYBOARD_SHORTCUTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ public static String getVolumeKeysBehaviourInternalPropertyValueFromValue(String



public boolean isZoomScaleDisabled() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_DISABLE_ZOOM_SCALE, true);
public boolean isTerminalViewScalingDisabled() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_DISABLE_TERMINAL_VIEW_SCALING, true);
}

public boolean shouldAllowExternalApps() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public TermuxTerminalViewClientBase() {
}

@Override
public boolean isZoomScaleDisabled() {
public boolean isTerminalViewScalingDisabled() {
return false;
}

Expand Down

0 comments on commit 720a649

Please sign in to comment.