We really need to define components of mortal sin, let’s take those against chastity, grave, yes, full knowledge, obviously yes or else we would not be afraid, complete consent, that needs some elaboration, going online and searching for porn constitute a consent, but is it complete, if this guy cannot take the idea out of his head, he prays, he cried, he whips himself with the USB cable and still cannot stop, even opens it at work or in public places, does that seem the act of a person who fully consents what he is doing or a struggling good man.
Anyway, it is included in the catechism about the reasons that diminish the guilt associated with that, but I think whoever is doing this particular sin, under whatever circumstances is a person who needs help not fear.
Catechism has what you are posting about, lack of complete consent. That can happen with habits. There should be resistance however, see the Baltimore Catechism too.
1862 One commits venial sin when, in a less serious matter, he does not observe the standard prescribed by the moral law, or when he disobeys the moral law in a grave matter, but without full knowledge or without complete consent.
Baltimore Catechism No. 3
Q. 1284. What is forbidden by the sixth Commandment?
A. The sixth Commandment forbids all unchaste freedom with another’s wife or husband; also all immodesty with ourselves or others in looks, dress, words, and actions.
A. Sins of impurity are the most dangerous:
Because they have the most numerous temptations;
Because, if deliberate, they are always mortal, and
Because, more than other sins, they lead to the loss of faith.
Q. 1317. What is forbidden by the ninth Commandment?
A. The ninth Commandment forbids unchaste thoughts, desires of another’s wife or husband, and all other unlawful impure thoughts and desires.
Q. 1318. Are impure thoughts and desires always sins?
A. Impure thoughts and desires are always sins, unless they displease us and we try to banish them.
Q. 1324. In what does the sixth commandment differ from the ninth, and the seventh differ from the tenth?
A. The sixth commandment differs from the ninth in this, that the sixth refers chiefly to external acts of impurity, while the ninth refers more to sins of thought against purity. The seventh commandment refers chiefly to external acts of dishonesty, while the tenth refers more to thoughts against honesty.